Skip to content

Comment on A safer git checkoutparent

Comments

It becomes dangerous if you have changes in your working tree. You truly lose those changes with a "git reset --hard HEAD" or the forced checkout.

Exactly. As mentioned in the article, `git reset --keep` is the preferred way to do it these days. It preserves uncommitted worktree changes.

Oh! I see. I would never do a `git reset` of any kind if I hadn't committed or stashed. Yikes!

AboutSource Built by g1lg1l

Hackerly is an independent reader for Hacker News, built on the public HN API. Not affiliated with Y Combinator.