git 我们可以在已经与 master 合并的分支上提交吗?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/21751082/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-19 09:43:46  来源:igfitidea点击:

Can we commit on branch that's already been merged with master?

gitversion-controlbranching-and-merging

提问by Intesar Haider

I have a branch, say "XYZ", I worked and did a few commits on that branch and later merged it with my master branch. Now, I want to do some more changes in my code and want to use that same branch. I have not deleted the branch.

我有一个分支,比如说“ XYZ”,我在那个分支上工作并做了一些提交,然后将它与我的主分支合并。现在,我想对我的代码进行更多更改并希望使用相同的分支。我没有删除分支。

Can I use the same branch again? Can I then merge the new commits with master again? Or is the only solution to create another branch?

我可以再次使用同一个分支吗?然后我可以再次将新提交与 master 合并吗?或者是创建另一个分支的唯一解决方案?

回答by maclir

You can still work on that branch as it still exists.

您仍然可以在该分支上工作,因为它仍然存在。

The git-mergedocumentation says:

混帐合并的文件说:

Incorporates changes from the named commits (since the time their histories diverged from the current branch) into the current branch.

将来自命名提交的更改(从它们的历史从当前分支开始)合并到当前分支中。

You can continue working on your branch and then when you merge with master again, it will bring the commits that are missing on master.

您可以继续在您的分支上工作,然后当您再次与 master 合并时,它将带来 master 上缺少的提交。