How to resolve git's “not something we can merge” error

前端 未结 25 1332
隐瞒了意图╮
隐瞒了意图╮ 2020-12-04 05:42

I just encountered a problem when merging a branch into master in git. First, I got the branch name by running git ls-remote. Let\'s call that branch \"branch-n

25条回答
  •  不知归路
    2020-12-04 06:19

    I had a work tree with master and an another branch checked out in two different work folders.

    PS C:\rhipheusADO\Build> git worktree list
    C:/rhipheusADO/Build         7d32e6e [vyas-cr-core]
    C:/rhipheusADO/Build-master  91d418c [master]
    
    PS C:\rhipheusADO\Build> cd ..\Build-master\
    
    PS C:\rhipheusADO\Build-master> git merge 7d32e6e #Or any other intermediary commits
    Updating 91d418c..7d32e6e
    Fast-forward
     Pipeline/CR-MultiPool/azure-pipelines-auc.yml | 5 +++--
     1 file changed, 3 insertions(+), 2 deletions(-)
    
    PS C:\rhipheusADO\Build-master> git ls-remote
    From https://myorg.visualstudio.com/HelloWorldApp/_git/Build
    53060bac18f9d4e7c619e5170c436e6049b63f25        HEAD
    7d32e6ec76d5a5271caebc2555d5a3a84b703954        refs/heads/vyas-cr-core 
    
    PS C:\rhipheusADO\Build-master> git merge 7d32e6ec76d5a5271caebc2555d5a3a84b703954
    Already up-to-date
    
    PS C:\rhipheusADO\Build>  git push
    Total 0 (delta 0), reused 0 (delta 0)
    To https://myorg.visualstudio.com/HelloWorldApp/_git/Build
       91d418c..7d32e6e  master -> master
    

    If you need to just merge the latest commit:

    git merge origin/vyas-cr-core 
    git push
    

    And is same as what I've always done:

    git checkout master # This is needed if you're not using worktrees
    git pull origin vyas-cr-core
    git push
    

提交回复
热议问题