fix: make git merge2 work across worktrees
Checkout of the target branch fails when it is already used by another worktree. Detect that worktree and merge there instead.
This commit is contained in:
+2
-1
@@ -73,7 +73,8 @@
|
||||
pt = push origin --tags
|
||||
ph = push origin HEAD
|
||||
pht = push origin --tags
|
||||
merge2 = !sh -c '_CURRENT_BRANCH=$(git symbolic-ref --short HEAD) && git checkout $1 && git merge $_CURRENT_BRANCH && git checkout $_CURRENT_BRANCH' -
|
||||
# 把当前分支合进目标分支后回到当前分支;目标已被其它 worktree 占用时在那边 merge
|
||||
merge2 = !$HOME/.dotfile/git/git-merge2.sh
|
||||
bg = "!f() { git branch | grep $1; }; f"
|
||||
delbr = "!f(){ git branch -D $(git branch | grep \"\b$1\"); };f"
|
||||
can = commit --amend --no-edit
|
||||
|
||||
Reference in New Issue
Block a user