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.

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

Make changes

git push --all

Pull in new updates

git checkout master
git pull origin master

Apply changes to master

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.

git checkout master
git merge bugfix
git push

Delete local and remote branches

Wait for your commits to be merged, and then:

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

If you found this post useful, please consider supporting my work with a cup of coffee ☕.