Hacker News new | ask | show | jobs
by m_mueller 3589 days ago
Could it be improved to have undo filter out its own reflog entries and instead have a 'redo' to undo those?
1 comments

I don't think that 'git undo' can tell with certainty which entries in the reflog are from it.

It would be a crude heuristic that's going to break.

Is there maybe a way to annotate the commit message of HEAD without influencing the reflog?
You can't change the commit message of a commit without changing the commit, which in most cases is a bad idea, if you don't know pretty much exactly what your doing.

Replacing one heuristic with another won't make this a stable operation.

A lot of people had already the idea to encode relevant information inside of documentation and it was always a bad idea in the long run.

I get that, I just wondered whether it's technically possible (with supported git operations, not hacking down at FS / byte level).
If you want to undo without reflog entries, just snip the most recent line off the reflog.

If you want to put annotations on commits, use tags with message bodies.

So yes, there are ways to accomplish what you want.

well, there is git-notes(1), but I'm not sure how it can be used as a journal for reflog operations.