My Technical Notes

Tuesday, 30 August 2016

Merging a Branch in Git

This script assumes that the branch `bug-fix` and branch `master` are in order.


git checkout master # switch to the master branch
git pull            # pull master content from the remote just in case it was changed.
git merge bug-fix   # merge the bug fix branch into master
git push --all      # push all branches

Now to delete `bug-fix` branch:


git branch -d bug-fix             # delete the bug-fix branch locally
git push origin --delete bug-fix  # delete the bug-fix branch of the remote

No comments: