Archive for November, 2011

GitHub – Changing current branch to master


If you have a repository in Git, made a branch say new_branch and did some changes in both master and the new_branch.

After many commits when you are in a need to convert the new_branch to master and to discard the commits done on master, try with the following set of commands.

git checkout new_branch
git merge --strategy=ours master   # it just records a commit, but retains the contents of new_branch
git checkout master
git merge new_branch   # fast-forward master up to the merge