Re: git cherry-pick before archive
From: Johannes Schindelin <hidden>
Date: 2016-06-15 22:44:55
Hi, On Fri, 11 Jul 2008, Denis Bueno wrote:
On Fri, Jul 11, 2008 at 14:46, Johannes Schindelin [off-list ref] wrote:quoted
BTW in your case, I would suggest this: INDEX_FILE=.git/bla git read-tree HEAD && INDEX_FILE=.git/bla git apply --cached patchfile && INDEX_FILE=.git/bla git archive [...] && rm .git/bla IOW: Just use a temporary index for your work.What is the rationale? So I can relieve the assumption that the index is clean?
Not completely. It will just leave the current index alone, ignoring the changes within it. It will also avoid having to update the index several times. IMO it is just the thing you should do here: you do not want to stage anything for commit, so keep .git/index as-is, and use a temporary staging area instead. It also avoids the need to "undo" things that might not be easily undone: if your patch contains stuff that was partly in the index, but uncommitted, neither "git reset" nor "git revert -n" will do what you want. Ciao, Dscho