Search code examples
gitmergegit-merge

Merging to a branch in git without switching to it


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 have to merge these changes into another branch (say master) but the snag is that I don't want to git checkout master before doing this. Is there some way to say "merge current branch into master"?


Solution

  • 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