Move branch label to different commit without checking out the branch
It would be very convenient if a branch label can be moved to different commit without having to check the branch out. Checking out an older version of a branch can take a long time and become painful when submodules are used, because some referenes may no longer be valid.
The workaround I'm using is deleting the branch locally and then create a new branch with the same name at the commit that should become the new branch head. It would be nice if this process could be automated.
Comments: 5
-
18 Feb, '22
Jonathan AdminHello Axel, this feature already exists. Consider using the "Reset Hard" option from the right-click context menu to manually move your current branch to a different commit.
https://support.gitkraken.com/working-with-commits/commits/#resetting-commits -
18 Feb, '22
Axel HeiderIt's not about the current branch, but about other branches. Hard-reset just works for current branches unfortunately.
-
21 Feb, '22
Joey Kelroy AdminHello Axel, from the terminal, you can also use `git checkout <branch-name> <SHA>` to create a branch at the desired commit without checking it out.
-
21 Feb, '22
Axel HeiderHi Joey, thanks for the tip. Basically, everything is possible from the terminal and with writing scripts. What I'm asking for here is a GUI solution based either on drag&drop (plus some mis-click-accident protection). This could also be something in the direction of https://feedback.gitkraken.com/suggestions/226670/add-the-ability-addrun-custom-macrosscripts in the end.
My use case is, that I have development branches that have several labels on their history. These are the things that are to be upstreamed or put into a extended Ci workflow, while I still work in the branch head - so it's usually the refactoring. When I have to rebase the whole dev branch branch, I usually rebase the brnach head. Once this is done, I have to move the other branch label to the new rebased branch. Here, having to check out each old branch can be painful, especially if files/folder/submodules have been added/remove in between. Just moving the branches via drag&drop would be more convenient. -
21 Feb, '22
Axel HeiderSince the context of my usecase is usually rebasing, this is related to https://feedback.gitkraken.com/suggestions/277633/rebase-r-preserving-merge-commits-while-rebasing partly also. The generic form of the feature request would be rebase preserving merges and being able to select which branch labels are to be moved also in the tree that is rebased.