How to merge the current branch into another branch

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 the following:

git checkout master
git merge dev
git checkout dev

That’s awfully verbose, and since I do it frequently, I’d like to minimize it. Is there any one git command I can use to merge from my current branch dev to the other branch master without having to checkout the master branch first? Something maybe like:

git merge dev to master

would be awesome. I looked through the git documentation and didn’t see anything.

8 Answers
8

Leave a Comment