Reputation: 17467
How do I view commits that are about to be pushed?
I'd made a local commit. Pull a change. And no it requires a merge. I prefer not to merge and would like to undo the commit, Pull, Update changes, Then commit again.
How do I do it since rollback
only undo the last command which is pull?
Upvotes: 1
Views: 3092
Reputation: 73798
- How do I view commits that are about to be pushed?
Use hg outgoing
. That shows what hg push
would have sent to the server. The opposite command is hg incoming
, which shows what hg pull
would have retrieved.
- I'd made a local commit. Pull a change. And no it requires a merge. I prefer not to merge and would like to undo the commit, Pull, Update changes, Then commit again.
Like Mark says, you're looking for the rebase extension. Enable it with
[extensions]
rebase =
in your config file and then run
$ hg pull
$ hg rebase
to move your local work (this can be multiple changesets, not just a single as in your work around!) on top of the changesets you just pulled down.
How do I do it since rollback only undo the last command which is pull?
Please don't use hg rollback
as a general undo mechanism. It's a low-level command that should not be used as much as it is, especially not by new users. The rollback command removes the last transaction from the repository — a transaction in Mercurial is typically the last changeset you made or the last changesets (plural) you pulled into the repository.
Upvotes: 1
Reputation: 178135
That's really the way Mercurial works, and you shouldnt fight it in the name of a straight linear history, but there are tools that can edit history. Enable the rebase
extension and just run hg rebase
after your pull. It will move your local commit to the tip automatically in the simple case you described.
Upvotes: 4