is there a quick way to do a recursive
hg forget
on a folder? I accidentally versioned things i don't want
What about
hg forget directory/*
?
Related
I just opened up a project that had the .hgignore file set up entirely wrong. I have fixed it to what it should be, and now I have to remove all the stuff that it was previously not ignoring and now should. Maybe its just early in the morning, but any way to do that other than manually?
(requires Mercurial >= 1.9)
$ hg forget "set:hgignore() and not ignored()"
see hg help filesets for more
If you see here, you'll see that I have:
CheeryTomatoe.Examples <--- I want to remove this.
CherryTomatoe
CherryTomatoe.Examples
https://bitbucket.org/sergiotapia/cherrytomato
How can I completely remove this from my repository? What command can I run?
In theory, you can edit the history (provided nobody has yet cloned your public repo), as described in:
Mercurial FAQ 4.14 and 4.15
Mercurial Wiki "Editing the History"
However, that is not the best way to work with Mercurial, so what you did in your third commit is better: hg rename:
See Hg book: "renaming file":
When you use the hg rename command, Mercurial makes a copy of each source file, then deletes it and marks the file as removed.
It is your initial commit.
Delete the repository and start over.
I have been making some changes to my working directory, and noticed that I have accidentally been working on the wrong branch. I have not committed anything yet, and I would like my next commit to go against another branch. What is the best way to do this?
The Shelve extension can give you grief, and this can be done entirely with Mercurial commands. Krtek almost had it but he used export instead of diff. Try this:
hg diff --git > ~/saved-work.patch
hg update --clean desiredbranch
hg import --no-commit ~/saved-work.patch
You should be able to just hg up otherbranch. It is important that you do not use the --clean option to hg up, either directly or via an alias as that will discard your uncommitted changes.
Another option is to use one of the extensions that provides hg shelve. The process would then be:
$ hg shelve --all
$ hg up otherbranch
$ hg unshelve
That will create a patch of your changes within the .hg directory, returning your working directory to a clean state, switch to the 'otherbranch', and then apply the saved patch.
I don't know if it is the best solution, but you can follow these steps :
1° hg diff --git > modifications.patch
2° hg update -C the_right_branch
3° hg patch modifications.patch
Maybe it's better to copy modifications.patch somewhere safe, just in case.
edit: update with diff instead of export. Thanks to the commenters.
How to kill mercurial repository? Can't find the command to accomplish the task.
I'm not sure what you mean by "kill", but you can remove a repository by deleting the .hg directory in your clone. Or just delete your entire clone directory.
Be sure this is really what you want to do, though. There's no undo.
I'm using Mercurial 1.7.2 Windows
I have a local repo where I copied some files into.Now I'd like to remove these files. I tried to use revert and update but those files are still there.
I tried these commands
hg revert --all
nothing, files stll there
hg update null
still nothing
I ran these commands from my repo using the commandline
Use PurgeExtension. It's a plugin for Mercurial. Purge is shipepd with Mercurial but by default is this plugin inactive. Enable it and then use:
hg purge
Try hg status. If it lists the files you copied there as unknown, all you need to do is delete them manually, as mercurial isn't tracking them anyway. Otherwise, you need to tell mercurial to forget or delete them from the repo. (e.g. hg forget foo.bar). Conversely, mercurial will not track new files until you tell it to, so if you copy files into your local repo, you need to do hg add foo.bar and then hg commit to make mercurial track them.
try:
hg remove
or look into the hg backout command