将开发分支与主人合并 [英] Merge development branch with master
问题描述
在GitHub存储库中有两个分支,即 master
和 development
。
git分支开发
git add *
我在开发分支中进行所有开发。 git commit -m我的初始提交信息
git push -u原始开发
现在我想将开发
分支上的所有更改合并到 master
中。我目前的做法是:
$ g $ check $ g $ git checkout master $ b $ git git merge development $ b $ git push -u origin master
请让我知道我所遵循的程序是否正确。
<我通常喜欢将
master
合并到开发
首先,如果有任何冲突,我可以在开发
分支本身解决,我的 master
保持干净。 pre $
(在分支开发上)$ git merge master
(解决任何合并冲突,如果有的话)
git checkout master
git merge development(现在不会有任何冲突)
这两种方法没有什么区别,但我有时会注意到,在合并后,我不想将分支合并到 master
中,或者在这些可以合并之前还有更多的工作要做,所以
编辑:来自评论
master >未改动,直到最后的东西。
如果您想跟踪合并时间和合并时间,您可以在合并时使用 - no-ff
标志。这只有在将 development
合并到 master
(最后一步)时才有用,因为您可能需要合并 master
转换为 development
(第一步),并为其创建提交节点可能不是很有用。
git merge --no-ff development
I have two branches namely master
and development
in a GitHub Repository. I am doing all my development in development branch as shown.
git branch development
git add *
git commit -m "My initial commit message"
git push -u origin development
Now I want to merge all the changes on the development
branch into the master
. My current approach is:
git checkout master
git merge development
git push -u origin master
Please let me know if the procedure I am following is correct.
解决方案 I generally like to merge master
into the development
first so that if there are any conflicts, I can resolve in the development
branch itself and my master
remains clean.
(on branch development)$ git merge master
(resolve any merge conflicts if there are any)
git checkout master
git merge development (there won't be any conflicts now)
There isn't much of a difference in the two approaches, but I have noticed sometimes that I don't want to merge the branch into master
yet, after merging them, or that there is still more work to be done before these can be merged, so I tend to leave master
untouched until final stuff.
EDIT: From comments
If you want to keep track of who did the merge and when, you can use --no-ff
flag while merging to do so. This is generally useful only when merging development
into the master
(last step), because you might need to merge master
into development
(first step) multiple times in your workflow, and creating a commit node for these might not be very useful.
git merge --no-ff development
这篇关于将开发分支与主人合并的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!