Reputation: 315
I have added a module by downloading it with drush command then I have type
hg addremove
Then
hg commit -m "Added Module"
Then
hg pull --update
Then hg push
The code is pushed in the reprository, Now my question is how do i get back to the previous changes. I have already pushed the code so is there any way to checkout with some revision. If we can checkout ,so will it delete all the added file from reprository.
Upvotes: 0
Views: 192
Reputation: 116967
The question as originally posed is somewhat unclear to me, but the last sentence, namely
If we can checkout ,so will it delete all the added file from reprository.
suggests there is some concern about changes being lost.
First, let me point out that mercurial goes out of its way to avoid losing information (unless specifically authorized to make unrecoverable changes), but nevertheless information might seem to be lost (e.g. if a file is backed up as ORIGINALFILENAME.orig); further, information can actually be lost, e.g. if one does something that modifies the backups.
Second, if you have any concerns about whether an "update" command will cause unwanted changes, be sure to use the --check
option, e.g.
hg --check update
The --check
option can be abbreviated to -c
but beware: the -C
option has almost the opposite effect.
Third, it may be worth pointing out that one way to gain confidence in one's understanding is to create a test repository, and experiment with it, e.g. along the lines :
mkdir test; cd test; hg init; ....; ...
cd ..; hg clone test cloned ; ....; ...
That way you can experiment with "hg pull" in the "cloned" repository.
Upvotes: 1
Reputation: 315
hg revert --all --rev "last revision number"
After witing this it will remove all the added file then push to get back to last revision.
This works for me
Upvotes: 2
Reputation: 722
What you need is
hg update -r <changesetID>
This changes your local files to the specified changesetID
. The changes will be removed from the local version, but not in the remote. Once changed to a revision that is different from the head, any changes that you push will create new heads.
Upvotes: 1