我正在尝试提交一个额外的(无关的)提交后,提交一个以前提交给Gerrit。我已经在两个独立的分支上创建了前面的和当前的提交。下面是工作流的一个示例:
git checkout -b <branch-1>git add folder1/*git commit -m "Added folder1."git review它提交给Gerrit,并输出信息,包括与评审的链接。之后,我去做另一个(同样是无关的)更改:
git checkout -b <branch-2>git add folder2/*git commit -m "Added folder2."git review正是在这一点上,我遇到了以下情况:
You are about to submit multiple commits. This is expected if you are
submitting a commit that is dependent on one or more in-review
commits. Otherwise you should consider squashing your changes into one
commit before submitting.
The outstanding commits are:
373ea8b (HEAD -> branch-2) Added folder2.
e626f4c (branch-1) Added folder1.
Do you really want to submit the above commits?
Type 'yes' to confirm, other to cancel: n
Aborting.我该如何避免这场冲突?
发布于 2017-08-07 11:26:53
问题是,您根据第一个提交完成了第二个提交:
A <= origin/branch
\
\-- B <= branch-1
\
\-- C <= branch-2要在不相关的分支上工作,您应该“并行”独立提交,如下所示:
/-- B <= branch-1
/
A <= origin/branch
\
\-- C <= branch-2第一次承诺:
git checkout -b <branch-1> origin/<branch>
git add folder1/*
git commit -m "Added folder1."
git review第二次承诺:
git checkout -b <branch-2> origin/<branch>
git add folder2/*
git commit -m "Added folder2."
git reviewhttps://stackoverflow.com/questions/45537858
复制相似问题