Github - Branching




1. To create a new branch

$ git checkout -b branch_b1



2. To swtich back to master

$ git checkout master


3. To create a new branch from any other branch (other than master)

$ git checkout -b branch_b2 branch_b1



4. To list the available branches in your current repository

$ git branch -a


5. To delete the branch

$ git branch -d BranchName


6. To make the branch available to others through server repository

$ git push origin BranchName


7. How to sync local branch to the latest master on the server ?


We can do that, by the following steps

(Assume we are branch b1)
git fetch 
(This will reset the whole branch b1 to the server version)

git rebase origin/master(This will merge all the latest master into the branch b1)



0 comments:

Post a Comment