Reputation: 3709
Maybe I am missing something important here but I want to switch to another branch without first committing what I currently have. I realize I can use hg update -C
and simply drop the current changes as well but this is not what I want to do either.
My problem is that I have several branches I am working on simultaneously and do not want to fill up my history with a large number of small commits. Is there a middle ground in which I can store my current branch without committing each little change I make in some cases.
Upvotes: 0
Views: 76
Reputation: 7755
Have each branch checked-out in it's own clone. You can switch between them without needing to do anything.
Upvotes: 0
Reputation: 5605
In addition to the options of the shelve option already mentioned, and having lots of small changesets in your history, you could use the collapse extension to take those small changesets and combine them into a single larger changeset. This is ideal for exactly the scenario you're describing - fixing typos, etc.
With Mercurial 2.1 and later the collapse extension will respect phases, so you won't inadvertently collapse changesets that you've published.
In general though, I'd advocate doing all those little changes on a separate named branch and then just merge into your default (or other feature) branch when you're happy.
Upvotes: 1
Reputation: 27242
The shelve extension can do what you want:
From the page:
Temporarily stash away changes. You can select the exact hunks of changes you want to shelve.
hg shelve
Temporarily stash away changes. All hunks will automatically be selected.
hg shelve --all
Get the changes back into the workdir.
hg unshelve
If you use the --name option you can shelve different changes on different shelves.
However, what's wrong with lots of little commits? If the changes stand by themselves they probably deserve a commit, you really don't want to put multiple issues in a checkin if you want to keep your sanity, particularly if you're going to merge features into other repos later.
Upvotes: 2