[英]Using Git, is it true that after making some changes, we can commit it to any branch?
Say, if a project using Git is all committed, with master
and foo
branch both point to the same commit. 假设,如果所有使用Git的项目都已提交,则master
和foo
分支都指向同一提交。 If we are now on the master
branch, and change some files, it seems that we can switch to the foo
branch, or even create a new branch: 如果我们现在在master
分支上,并更改了一些文件,看来我们可以切换到foo
分支,甚至可以创建一个新分支:
git checkout -b bar
and commit the changes to any of the 3 branches? 并将更改提交给这三个分支中的任何一个? So it is like, the changes remain "flexible" for the programming to commit to whichever branch chosen? 因此,对于选择提交到哪个分支的更改,更改仍然“灵活”。 (even commit to foo
if there is one or several more commits already done in the foo
branch, as long as the modified files didn't overlap with any files in those commits). (只要在foo
分支中已经完成了一个或多个其他提交,即使已修改的文件不与那些提交中的任何文件重叠,也可以提交给foo
)。
Yes. 是。 You will be stopped from changing branches if there is a conflict. 如果发生冲突,您将被禁止更改分支。 Otherwise, it Just Works. 否则,它将正常工作。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.