sublimehq / sublime_merge

Issue tracker for Sublime Merge
https://www.sublimemerge.com
272 stars 14 forks source link

update-refs support #1877

Open Lorak-mmk opened 4 months ago

Lorak-mmk commented 4 months ago

Problem description Some time ago git added a --update-refs flag to rebase. This flag is awesome when working with stacked branches. What it does is when we have a series of commits like this:

A ---> B ---> C (branch-Y) ---> D ---> E (branch-X)

and then checkout branch-X and perform rebase on A, for example to edit B's message, git will update where branch-Y points to. With update-refs it will look like this after the rebase:

A ---> B' ---> C' (branch-Y) ---> D' ---> E' (branch-X)

without update-refs:

          B ---> C (branch-Y) ---> D ---> E
       /
    /
A ---> B' ---> C' ---> D' ---> E' (branch-X)

When editing commits using sublime merge the second behavior is present, which is frustrating if you have more than one branch in a line of commits.

--update-refs can be set as default in gitconfig:

[rebase]
    updateRefs = true

however it seems to not have any effect in SM. From what I see in git console it's because SM doesn't call rebase, it uses commit-tree and update-ref instead.

So after any edit I need to, for each branch

Preferred solution

Please implement --update-refs behavior in SM, possibly enabled somewhere in preferences.

Alternatives

The alternative would be for SM to use git rebase when editing commits, so that --update-refs can be enabled in global git config.

KindDragon commented 2 months ago

Sublime Merge ignore for git config --global rebase.updateRefs true when I try to use Edit Commit Content it ignore this option