top | item 30210801

(no title)

good-idea | 4 years ago

I don't have any good resources off-hand (other than what shows up in a quick search), but my "best practices" are to always squash and keep PRs as small as possible.

When a working branch falls behind main, I prefer to rebase it instead of merging from main to keep it up to date. However, if you've already pushed your working branch to a repo, after rebasing you need to `git push --force` - which is a problem if there are others who have previously cloned the working branch.

discuss

order

vincentmarle|4 years ago

Squashing also introduces problems when you are resolving merge conflicts in your branch: squashing doesn’t preserve merge conflict resolution so you end up having to resolve those conflicts again after merging.

codyb|4 years ago

Great comment and spot on. You can avoid the issue with force by using `—force-with-lease` which won’t push the force if there’ve been changes upstream.

That’s a bunch to type so I alias it to `fwl` In `~/.git config` and use it after rebases.