I have situation like this:
I have commited files a,b,c,d.Now i found that by mistake i commited files a and b; so before pushing these changes, i want to do uncommit files a and b so that i can push only c and d.Can someone tell me how to do that by using mercurial commands.
Here uncommit means that i dunt want to use "hg out -p" and after that looking change set and do things manually.
If you are still in the draft phase (not pushed elsewhere yet), use the built-in extension hg strip <rev> command. Otherwise, you should do a hg backout , which will reverse the changeset. In case you still need the commit you made, I suggest you export it to import it again in the correct branch, before stripping.
You need to login to the server and use the hg strip command. If you cannot login to the server, you are out of luck; you can hg backout then push again, but this will leave the bad commits on the server along with the commit that undoes them. Show activity on this post. hg revert -r .
hg amend [OPTION]... [ FILE]... aliases: refresh. combine a changeset with updates and replace it with a new one. Commits a new changeset incorporating both the changes to the given files and all the changes from the current parent changeset into the repository.
Assuming you haven't performed any other transactions on your repository since you committed the files, I think you could do this as a 2 stage process:
hg rollback hg commit filec filed
hg rollback
should remove the commit that you have just made, but leave the files as changed. Then hg commit filec filed
should commit the files named filec
& filed
. Obviously you should replace these file names with the names of your actual files.
It's probably worth mentioning that you should be careful with hg rollback
- it alters the history, so it is possible to lose data with it if used incorrectly.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With