我对存储库的本地克隆进行了一些更改,并将它们提交到本地分支。 我们称这些更改为“提交A”。 我想继续工作在提交A之上,但是当我准备好合并回主分支时,我不想提交合并。
我想我可以使用git rebase -i并删除提交A,但是有没有办法让该提交保持活动状态,以便将来的工作可以完成? 然后,再次,工作合并回主分支而无需提交A.
我意识到我所做的有点粗略,但是在提交A中改变的行与其上面的工作是正交的。 这些更改与机器(生产和测试)之间的差异有关,因为它们必须引用不同版本的第三方库。
I made some changes to my local clone of a repository and committed them in a local branch. Let's call these changes "commit A". I want to keep working on top of commit A, but when I'm ready to merge back into the main branch I don't want commit A merged.
I'm thinking I can use git rebase -i and delete commit A, but is there a way to keep that commit alive, so that future work can be done on top of it? And then, again, the work merged back to the main branch without commit A.
I realize that what I'm doing is a bit sketchy, but the lines changed in commit A are orthogonal to the work on top of it. The changes are related to differences between machines (production and testing) because they must reference different versions of a third-party library.
最满意答案
我想我可以使用git rebase -i并删除提交A,但是有没有办法让该提交保持活动状态,以便将来的工作可以完成? 然后,再次,工作合并回主分支而无需提交A.
你可以给它加标签。 从分支中删除的提交不会消失。 然后当你需要它时,你可以挑选标签。 那是:
git tag somename SHA1 ... git rebase -i OLDREV ... git cherry-pick somenameI'm thinking I can use git rebase -i and delete commit A, but is there a way to keep that commit alive, so that future work can be done on top of it? And then, again, the work merged back to the main branch without commit A.
You can tag it. The commit deleted from the branch will not be gone. And then later when you need it, you can cherry-pick the tag. That is:
git tag somename SHA1 ... git rebase -i OLDREV ... git cherry-pick somename更多推荐
发布评论