How to merge the current branch into another branch

前端 未结 8 972
忘了有多久
忘了有多久 2020-12-04 04:44

I have two branches, master and dev. I always work on dev and only check code into the master branch once it\'s been approved for production use. When I do so, I have to do

8条回答
  •  星月不相逢
    2020-12-04 05:39

    Your best bet would be to just use an alias, placed in your global gitconfig (~/.gitconfig):

    [alias]
        merge-to = "!f() { git checkout $1 && git merge $2 && git checkout -; }; f"
    

    so that you can invoke it from any repository as

    git merge-to master dev
    

提交回复
热议问题