How to delete commits (and git branches) completely ? #4709
-
Thank you for jj, which is awesome! My question: I'm cleaning up a repo (because jj log showed me that I have hundreds of stale old branches in it). I have found jj better than git for finding old branches to delete. And I've found that But not the commits themselves, I think because they are still referenced by git refs created by jj like I also tried jj abandoning them, which didn't help. Then I saw
So do I need to jj op abandon all operations that mention them, as well ? It seems hard. |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 4 replies
-
Yes, that's what you need to do. If you just deleted the branches, then you'll have to abandon most operations in your repo. |
Beta Was this translation helpful? Give feedback.
-
Thanks @martinvonz! Losing all operation history of course sounds bad. Is there any way to see which operations reference those commits ? I didn't see an obvious one. |
Beta Was this translation helpful? Give feedback.
Thank you, --expire=now (or --prune=now on the git side) was another important clue. And noted about evolog.
For the record, I got these stale branches cleaned out in this way:
jj log --no-graph -r 'bookmarks() ~ person(simon)' -T 'bookmarks++"\n"'
jj bookmark create ...
rm -rf .jj
for b in ...; do git branch -D $b; done
gsed -i '/\/keep\//d' .git/info/refs; gsed -i '/\/keep\//d' .git/packed-refs
r…