Skip to content

Is there a way to automatically "clean" empty commits? #2481

Answered by ilyagr
BatmanAoD asked this question in Q&A
Discussion options

You must be logged in to vote

I hadn't even realized this was possible, but it apparently is.

Try jj log -r 'empty() ~ merges()'. If you like the result, you can jj abandon 'empty() ~ merges()'. If you include merges, there is a minor bug with abandon (#2482) that will mess up the topology of the repo a bit.

At the moment, I don't see a way to exclude commits with non-empty descriptions.

Update: Actually, @yuja implemented that as well.

jj log -r '(empty() ~ merges()) & description(exact:"")'

Replies: 2 comments 24 replies

Comment options

You must be logged in to vote
22 replies
@BatmanAoD
Comment options

BatmanAoD Nov 2, 2023
Collaborator Author

@BatmanAoD
Comment options

BatmanAoD Nov 2, 2023
Collaborator Author

@martinvonz
Comment options

@necauqua
Comment options

necauqua Nov 3, 2023
Collaborator

@BatmanAoD
Comment options

BatmanAoD Nov 3, 2023
Collaborator Author

Comment options

You must be logged in to vote
2 replies
@martinvonz
Comment options

@BatmanAoD
Comment options

BatmanAoD Nov 5, 2023
Collaborator Author

Answer selected by BatmanAoD
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
5 participants