如何将当前分支合并到另一个分支 [英] How to merge the current branch into another branch
问题描述
git checkout master
git合并开发
git checkout dev
这非常详细,而且我经常这样做,所以我想尽量减少它。是否有任何一个git命令可以用来从我当前的分支机构合并到另一个分支主机,而无需首先检出主分支?可能是这样的:
pre $ git merge dev to master
会很棒。
1.添加远程文件
git remote add self file:/// path / to / your / repository
(或在窗口 git remote add self C:\path\to\\ \\ your_ \\ repository
)
2。推到自我远程,例如:
git push self dev:master
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.
1. Add a remote alias for your local repository, ex:
git remote add self file:///path/to/your/repository
(Or on windows git remote add self C:\path\to\your\repository
)
2. Push to the self remote, ex:
git push self dev:master
这篇关于如何将当前分支合并到另一个分支的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!