Keep stash after git filter-branch --subdirectory-filter
I recently split out my repository (residing in bigproj
) using git filter-branch --subdirectory-filter deep/in/my/project
. Then, I moved .git
directory to deep/in/my/project
.
Now, stash 开发者_如何学JAVAis in a strange state, where the top stash is something like:
stash@{0}: filter-branch: rewrite
I can't drop this stash, as I get this error (after git stash drop
):
refs/stash@{0}: not a valid stashed state
Now, even if I know the refid of stash@{1}, it still contains diffs for files in bigproj
hierarchy. Is it possible to re-write stash data, so that it only contains files belonging to deep/in/my/project
hierarchy?
I had the same problem after using git filter-branch
. The following command prunes the stash completely and therefore also deletes the entries created by git filter-branch
. Warning! that all stashed changes may be impossible to recover after calling this command, so make sure to apply all other stashed states before you call the command.
git stash clear
I'm guessing you have to do the drop
and pop
before you move the .git
directory. You can always re-stash it after you move.
精彩评论