Merging to a branch in git without switching to it

后端 未结 3 1424
盖世英雄少女心
盖世英雄少女心 2020-12-23 21:46

I have an application running in a git repository on a branch (say dev). The application modifies the content in some the repository and commits them. I now hav

相关标签:
3条回答
  • 2020-12-23 21:57

    This works very well for me when wanting to merge two branches without having to checkout either of them:

    git fetch . <modified branch>:<destination branch>
    

    Other options are described here.

    0 讨论(0)
  • 2020-12-23 22:02

    The "master" in your case appears to be "fast-forwardable". You could "push" the branch to master.

    cd /path_to_dir_with_no_branch_switch/
    git push . appbranch:master
    
    0 讨论(0)
  • 2020-12-23 22:09

    One possible solution would be to clone the repo and perform the merge in said clone (with master checked out), being able to solve potential conflicts there.

    Then, at a later date, when able to checkout master in the first repo, you would pull from the clone the updated master branch.

    0 讨论(0)
提交回复
热议问题