DEV Community

Discussion on: Git + GitHub Best Practices for Teams (Opinionated)

Collapse
 
victoryarema profile image
Victor Yarema • Edited

"merged the remote branch into yours" - why don't "rebased your branch onto remote one"?

Collapse
 
bholmesdev profile image
Ben Holmes

Fair point! Stems from my bad habit of merging the remote even when it's not the best choice.

Basic explanation to those unaware: rebasing will shift all of your commits to after the last commit of the remote, making your branch look like it's building off of the master / develop you want to merge in. Just merging will not fix up the commit history like this, even though it yields the same resulting code in your editor. This article gives a nice visual.

I'll make an edit shortly :)

Collapse
 
victoryarema profile image
Victor Yarema

I forgot to add that some projects have specific rule that states something like "rebase your changes on top of upstream before creating pull request".

Thread Thread
 
victoryarema profile image
Victor Yarema

Found example.
"Note that it is highly recommended to keep your pull requests up-to-date. If you do not know how to do this, take a look on manpage of git-rebase."
github.com/termux/termux-packages#...