Tortoise Mercurial - combine 2 commits

笑着哭i 提交于 2021-02-08 06:32:40

问题


I am starting to use Mercurial:

1.) I pulled the latest updates from public (central) repository (revision 3029)

2.) Working on code, I made a commit - revision 3030

3.) Some additional work, and - I made another commit 3031.

So, both of my commits 3030 and 3031 are in a local repository. At this stage my local repo looks like this

There are no commits by other people in Central repository.

I am finished at this point, and submit the code for code review - my reviewer tells me that there should be only single commit. I need to "get rid" the commit at revision 3030, and keep the 3031 revision.

If I do "strip" at a revision 3030, it strips both 3030 AND 3031. (I know how to restore from the back up, so I did not loose anything. I restored back).

how can combine revision 3030 and 3031 into a single commit using Tortoise HG ?


回答1:


Using Revert All Files.

One easy way, as long as you don't have any uncommitted changes in your working directory.

update to the commit before the changes you want to squash.

right click on latest commit and click "Revert all files..." This sets you working directory state, to be as if you were updated to the last commit.

Now just make a new commit, the contents of which will be the last two commits.

Then you can use 'strip' to remove the unwanted branch. (or just change the phase to secret to prevent it getting accidentally pushed)




回答2:


Using Rebase.

first enable rebase

Then select the bottom/oldest commit, and click rebase.

In the rebase options screen select collapse.

You will be then asked to enter a new commit message.



来源:https://stackoverflow.com/questions/61376407/tortoise-mercurial-combine-2-commits

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!