-
Notifications
You must be signed in to change notification settings - Fork 725
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
While filter-repo by default will abort if there are any stashes in the git repository (because that makes it look like not a clean clone), it is not uncommon for people to want to work on repositories that are not clean clones. In such cases, rather than simply dropping all their stashes, it is nicer if we can "rewrite the stashes" too. To do so, we: * get the revision for each stash (getting the merge commit ID is sufficient since revision walking then includes all the parents) * get a copy of the contents of the .git/log/refs/stash file * provide the revisions for each stash to fast-export so that it iterates over the stashes too * between the reflog expiration and repacking steps, write out the contents of the .git/log/refs/stash file after first substituting for all the rewritten commits Interestingly, the issue was caused by running git reflog expire --expire=now --all && git gc --prune=now --aggressive upon completion of the filtering; it is the reflog expiration step in particular that wipes out all the stashes. So, any page that recommends running both of those steps or any tool that recommends running those is putting their users' stashes at risk. As far as I can tell, that makes git-filter-repo (after this commit) the first repository filtering tool to not have the stash deletion problem. Signed-off-by: Elijah Newren <[email protected]>
- Loading branch information
Showing
3 changed files
with
64 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters