Confusion about remote vs local
aimran-adroll opened this issue · 1 comments
Hi,
Thanks for the amazing tool.
I am a touch confused about how branches are labeled. Here is the following scenario
git checkout my_stuff
git rebase her_stuff
# ... conflict happened
vi readme.md
I have noticed that if I run git rebase her_stuff
instead of git merge her_stuff
, the former marks the windows very differently. For example remote
window ends up having my stuff whereas local shows her_stuff
.
What is the optimal setup in this scenario? Or is this not the right tool for rebase type workflow?
This is how rebases work. The remote
corresponds to the branch you have checked out that you're placing on top of the branch you passed to the rebase
command, i.e. that you're rebasing onto. So if your branch my_stuff
and you're rebasing onto her_stuff
, git does something like checks out her_stuff
and then plays back the commits from my_stuff
on top of it. As such, if a conflict happens, her_stuff
looks like local
and my_stuff
looks like remote
.
You can change your default layout to refer to "local" instead of "remote", and prefer revision to prefer "remote":
" In 'vimrc', set your default layout.
let g:mergetool_layout = 'ml'
let g:mergetool_prefer_revision = 'remote'
to get the behavior for rebasing to match what normally happens for merging. A while back I thought about trying to auto-detect rebase vs merge and set the appropriate thing in those cases, but I got lazy...