News for hackers. Stuff that matters.
Re:GitButler: Fearless Rebasing by Yasuraka on Wednesday October 23, 2024 @04:44PM (#41929117)
Did you mean reflog?

Either way, even simpler, imho, than any log that one has to comb through after the fact is to create a named backup

  branch=$(git branch --show-current) && git switch -c backup-${branch} && git switch -
Carry on as planned and if you bork it all, switch to the backup branch which retains the original commits and all, delete the borked one and have another go

  git switch backup-somebranch && git branch -D somebranch && git branch -m somebranch
Re:GitButler: Fearless Rebasing by keybored on Wednesday October 23, 2024 @05:49PM (#41929561)
You don’t have to comb through the reflog for the pre-rebase branch state. Use `@{1}` from the reflog of the branch (not `HEAD`).[1]

Note: First I thought that `ORIG_HEAD` was the thing. But that won’t work if you did `git reset` during the rebase.

(`ORIG_HEAD` is probably “original head”, not “origin head” (like the remote) that I first thought…)

[1] You just have to comb through documentation!

Re:GitButler: Fearless Rebasing by 0xCAP on Wednesday October 23, 2024 @05:12PM (#41929299)
I have a custom bash function named "backup_branch" that does exactly that, along with "restore_backup" and "delete_backups". It's made my life 10x simpler.
Re:GitButler: Fearless Rebasing by Pfiffer on Wednesday October 23, 2024 @05:40PM (#41929508)
I do this as well but `git reset --hard backup-somebranch` and try again if I mess it up.