Git development workflow

Git development workflow

2 min read

Git, it's the most popular version control system and widely the most used for tech companies. In fact, as a software developer you'll be continuously using a tool like that.

I'll try to explain the best workflow I've found so far working on a codebase with a lot of people. There's no silver bullet for Git, but from my own experience feature branches, rebase and squash makes my workflow easier 👨‍💻.

Feature branches

Create a new branch every time you start doing a new feature, bug fix, whatever.

git checkout -b feature-branch


Always rebase a feature branch on top of master before merging it. Even though there are no conflicts, it's always good to test your features or changes with the latest master available.

You'll avoid a lot of problems by just doing:

git rebase -i origin/master

After that you'll need to push --force the branch, because the history has been modified and now your changes are on 🔝 of master ✨.

Squash and Merge

To maintain a healthy master log 📖 use --squash when merging a branch. All your commits will be grouped in a single one. Remember to keep your master history clean and easy to understand ☀️.

git merge --squash feature-branch
git commit -m 'Squash commit message'

Enjoyed the article? 😍

Subscribe 👨‍💻