Merging Branches
Call ‘git fetch’ if necessary to fetch refs from other repositories, then
git checkout <branchToContinue>
so the current branch is the one that will persist.
To check if the merge will require merge resolution or not, use
git merge --no-commit <branchToMerge>
git merge --abort
Finally, call
git merge <branchToMergeAway>
to merge that branch into the current branch. This may require some merge resolution.
If the merge fails and now is not a convenient time to resolve merge conflicts, abandon the merge with
git reset --hard HEAD
Deleting a Branch
git branch -d <branchname>
git push origin :<branchname>
The first command deletes the local branch and the second deletes the copy on the repository.
Remember these deletions are only pointers and the commits remain, although a ‘dangling commit’ will eventually be removed by garbage collection.
Posted Tuesday 14 July 2015 Share