Wednesday 18 September 2013

Useful Git Commands

Clone Command:

git clone "Your_remote_source_name"

Check Status:

git status

Create branch:

git branch "Name_of_your_new_branch"

Change branch:

git checkout "Your_branch_name"

View all branch:

git branch

Add project:

git add .

Commit Project:

git commit -m "Your_comments"

Push Project:

git push origin "Your branch Name"

Pull Project:

git pull origin "Your branch Name"

Clone specific branch in git:

git clone -b "Your_branch_name" "Your_remote_source_name"

Rename local branch in git:

git branch -m "old_branch_name" "new_branch_name"

If you want to rename the current branch, you can simply do:

git branch -m "new_branch_name"

Delete specific branch in git:

git branch -D "Your_branch_name"

To Remove deleted files from Git Repository use following command:

git add .
git commit -a -m "Message_in_quote"

Initialize directory and push to remote repository:

git init
git add .
git commit -m "first commit"
git remote add origin your-remote-repo-url
git push -u origin master OR git clone origin master
Reference: https://www.kernel.org/pub/software/scm/git/docs/

Learn Git branching:

https://learngitbranching.js.org/

GitSheet

https://gitsheet.wtf/

No comments:

Post a Comment