Today I spent about 3 hours trying to figure out a coherent git workflow for a team (spoiler: I don’t have it yet). I believe this “team git workflow” is properly called continuous integration.
I discussed the following approach with other web developers:
So let’s say I just cloned my team’s repo that has a
dev branch. I’m in my terminal and locally I have a
dev branch. I’m currently on
dev. Does this git workflow make sense?
- Locally, I create a new
featurebranch to implement a feature:
git checkout -b feature
- I implement the feature and commit:
git add .
git commit -m "implement feature"
- I change to my local dev branch:
git checkout dev
- I pull changes from the remote
devbranch in case a teammate pushed any changes:
git pull origin dev(if there’s a merge conflict locally, I solve it)
- I merge my
featurebranch into my
git merge feature
- I push my
devbranch to the remote repo’s
git push origin dev
- Rinse and repeat
The response I got was of general approval with a couple of constructive remarks. The first and most pertinent one is that a Pull Request (PR) review should be implemented in the workflow. The other and less pertinent one is that the local merging of the
feature branches is unnecessary.
Anyway, I will share a few resources that helped me figure out the above workflow but, like I said, there’s a lot of room for improvement so take it with a grain of salt. I will update whenever I feel more confident with this dynamic.