- Branch from develop
- Commit as you go
- Merge develop into your branch
- Push branch, create PR
- When branch is ready to merge, merge the PR
- Simple; everybody is familiar with it already
- Branch history is preserved in develop, even after branches are deleted
- git-blame is accurate since original author of all commits is preserved
- Develop is full of "Merge branch 'develop'..." commits
- Develop is full of work-in-progress commits
- Single changes are scattered across multiple commits
- Branch from develop
- Commit as you go
- Rebase develop into your branch
- Push branch, create PR
- When branch is ready to merge, squash commits locally and rebase (or cherry-pick) into develop
- Develop maintains a clean, "meaningful" history
- Branch history is preserved on GitHub
- Lack of merge commit removes context around merge (easily fixed by no-ff merging instead of cherry-picking into develop)
- GitHub becomes a branch graveyard
- git-blame is inaccurate if commits from multiple authors are squashed
- Branch from develop
- Commit as you go
- Rebase develop into your branch
- Push branch, create PR
- When branch is ready to merge, squash commits and force-push
- Merge the PR
- Develop maintains a clean, "meaningful" history
- Merging into develop gives context of when change was merged as well as when it was authored
- Branch history is lost* when branch is deleted
- git-blame is inaccurate if commits from multiple authors are squashed
* Well, sort-of. You can still find the commits if you know what you're doing. But the commits will be "dangling", which means they're completely at the whim of Git's garbage collection.
Comment on the Squash locally and cherry-pick approach - you can delete branches and still have access to the commits within the PR.
If you are merging your own PR, then you can use the following:
Within
git commit
we usually set the title as the PR title, and the description asCloses #<PR_num>
.