News for hackers. Stuff that matters.
Re:Ask HN: What's the worst piece of software you use everyday? by dreamcompiler on Saturday July 11, 2020 @10:23PM (#23808192)
> I fairly often make a branch as a sort of named undo point

Could you say more about this? I use

  git checkout -b new-branch
all the time, but that checks it out. What does "using an un-checked-out branch as an undo point" mean? Don't you have to check it out to commit changes to it? I suppose I could read the docs but the git docs are awful.
Re:Ask HN: What's the worst piece of software you use everyday? by hellofunk on Saturday July 11, 2020 @11:09PM (#23808470)
It creates the branch immediately for your last commit on your current branch. Therefore you have just named an undo point you could use later.
Re:Ask HN: What's the worst piece of software you use everyday? by bacon_waffle on Saturday July 11, 2020 @11:52PM (#23808654)
Occasionally I find it handy to tentatively do a rebase or similar, where I'm confident that the rebase itself will succeed but not so confident that the result will be something that I want to keep. In that case, making a branch at the current commit (using "git branch new-undo-point") will leave an easy way to return to the current state as if the rebase never happened.

Recently, in explaining this to a colleague who's relatively new to git, I think the "aha" moment came in realising that if you rewrite the history leading to commit X, you're really making new commit Y in addition to the old commit X - you're not changing X in to Y. Leaving a branch pointing at X is enough that git will keep it around after the history rewriting, in case you decide to do something with it later.

Re:Ask HN: What's the worst piece of software you use everyday? by dreamcompiler on Sunday July 12, 2020 @01:52AM (#23809191)
Ah. I get it. You're talking about using a new branch name as a tag for an existing commit. Thanks.