Re: Unexpected behaviour with git stash save --keep-index?
- From
Karl Hasselström <kha@treskal.com>
- Date
- Sep 2, 2008, 07:45 UTC
- Message-ID
- <20080902074516.GA5402@diana.vm.bytemark.co.uk>
- In-Reply-To
- <B1185033-36D7-4504-92A3-6F75B6CE90DF@gmail.com>
On 2008-09-02 01:14:10 +0200, Jonas Flodén wrote:
> while I was using StGit for the first time
[...]
> Also maybe someone could someone recommend a way to split an unclean > working dir into several patches/commits?
This is what I usually do:
1. Create a new StGit patch with all the changes.
2. Pop that patch.
3. View the patch in an emacs diff-mode buffer, and repeatedly
a. apply one or more hunks, and
b. create a new patch with just those changes
until no more changes remain.
Another way to do it would be to
1. Use e.g. git-gui to stage the changes you want in your first
patch. 2. Make an StGit patch out of just that (with e.g. stg new and stg
refresh --index).3. If the worktree is still dirty, go to step 1.
A third method I usually make use of is to commit very often while developing, and periodically clump these microcommits together into larger commits. This sidesteps the whole problem of splitting up a commit into pieces, which can be quite a chore if splitting on hunk boundaries isn't enough. (stg coalesce will turn two or more smaller patches into one large patch for you. And I'm pretty sure git-rebase --interactive has some equivalent functions.)
--
Karl Hasselström, kha@treskal.com
www.treskal.com/kalle