This is what I normally do when rebasing my current branch whilst keeping my local branching from getting flattened:
git fetch origin
git rebase -r origin/develop
-r
is --rebase-merges
, which I prefer over --preserve-merges
My question is: is there a way to pass this when doing git pull --rebase
?
Eg - I'd like to run the equivalent of the command above like so:
git pull --rebase=rebasemerges origin develop
instead of:
git pull --rebase=preserve origin develop
**edit: OK - looks like in 2.22, --preserve-merges
is getting deprecated in favour of --rebase-merges
. This is for git rebase
though - fingers crossed the changes gets carried over to git pull --rebase
git 2.22 has been released.
To answer my own question - this is the equivalent command:
git pull --rebase=merges origin develop
Taken from the manual page:
-r --rebase[=false|true|merges|preserve|interactive] When true, rebase the current branch on top of the upstream branch after fetching. If there is a remote-tracking branch corresponding to the upstream branch and the upstream branch was rebased since last fetched, the rebase uses that information to avoid rebasing non-local changes.
When set to merges, rebase using git rebase --rebase-merges so that the local merge commits are included in the rebase (see git-rebase1 for details).
To make this a default pull behaviour:
git config --global pull.rebase merges
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With