sublime_merge icon indicating copy to clipboard operation
sublime_merge copied to clipboard

update-refs support

Open Lorak-mmk opened this issue 1 year ago • 1 comments

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

  • checkout the branch
  • find the commit it should point to
  • hard reset it

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.

Lorak-mmk avatar Mar 05 '24 17:03 Lorak-mmk

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

KindDragon avatar May 08 '24 11:05 KindDragon