Skip to main content

Git topic branch workflow

I find that the “topic branch workflow” is one of the cleanest ways to work with code using Git. Here’s my cheat sheet for how it’s done.

Pull in the repo

This is possibly a fork from Github.

Terminal window
git clone https://example.com/repository.git
cd repository/
git checkout -b bugfix

Make changes

Terminal window
git push --all

Pull in new updates

Terminal window
git checkout master
git pull origin master

Apply changes to master

Terminal window
git checkout bugfix
git rebase master

If you don’t have commit access, here’s where you open a pull request and nicely explain it.

Terminal window
git checkout master
git merge bugfix
git push

Delete local and remote branches

Wait for your commits to be merged, and then:

Terminal window
git branch -D bugfix
git push origin --delete bugfix

If you found this post useful, please consider supporting my work with some cheese 🧀.