I wrote the git policy for the last two companies I was at. This is not a great article but I would never use git flow. Here's what I do:
master branch, always kept green via CI
all git ops done via command-line interface only. if you don't know the cli you shouldn't be using git.
feature branches, prefixed with the initials of the engineer jd-fix-auth-tests
manually squash and rebase every commit before merging to master
all commits on master must be atomic features (reverting HEAD should always yield a deployable build)
avoid merge commits like the devil because they can obscure history: I've seen files not exist on head but git log -p -- file/name.rb only shows the insert because merge conflict resolution can silently delete files.
In rare cases of very massive release branches getting merged into master I'll tolerate a merge commit so long as it's rebased first.
Tags for releases, delete all branches after they're merged.
Not everyone will agree with me but this approach has got 6 years of battle-testing to speak for it with non-trivial teams and projects. My git history is so clean you could eat off it.
7
u/aurisor Jun 19 '15
I wrote the git policy for the last two companies I was at. This is not a great article but I would never use git flow. Here's what I do:
master branch, always kept green via CI
all git ops done via command-line interface only. if you don't know the cli you shouldn't be using git.
feature branches, prefixed with the initials of the engineer
jd-fix-auth-testsmanually squash and rebase every commit before merging to master
all commits on master must be atomic features (reverting HEAD should always yield a deployable build)
avoid merge commits like the devil because they can obscure history: I've seen files not exist on head but
git log -p -- file/name.rbonly shows the insert because merge conflict resolution can silently delete files.In rare cases of very massive release branches getting merged into master I'll tolerate a merge commit so long as it's rebased first.
Tags for releases, delete all branches after they're merged.
Not everyone will agree with me but this approach has got 6 years of battle-testing to speak for it with non-trivial teams and projects. My git history is so clean you could eat off it.