Undo your last git mistake with ugit

📅️ Last Updated: June 28, 2020  • đź“…️ Published: April 30, 2021  • đź•Ł 3 min read

Undo your last git mistake with ugit

So I have been working on this little tool called ugit (and was finally able to release a stable version), the goal is to make it easier for beginner to intermediate git users to undo their last (accidental) git command. Because we are not perfect and commit mistakes.

“Oh wait I deleted the auth-jwt branch without merging!! fuck”
Opens browser
“How to restore deleted branch”
Wastes 5 minutes reading the thread,
Brain context switch, losses focus
“Aarrgh, Git sucks”

Failure is a good way to learn something new but how many times are you going to mess up with git, if your ultimate goal is to deliver the new feature in your startup as fast as possible, huh? Git is great but it’s not really good with developer experience (DX).

Yo bhupesh, I can just you know alias this command. Oh cool, good luck remembering that alias after 1 month when you fuck-up again.

If you are in the gang of getting things done, adding ugit might be a good choice for you.

Ok enough talking.

What is ugit?

It’s just a shell script with guided programmatic steps to undo your last git command, powered by FZF built for people who live and work with terminals every day.

Guided Tutorials

Below are some GIF demos of undoing some git operations, the list is long (around 17 scenarios) but I am only demonstrating some common ones.

Head over to installation instructions for ugit

Undoing git add

Undoing git branch -D (Restore deleted branch)

Undoing/Restoring file to previous version

Undoing git merge

Story behind ugit

Part of credits go to Anthony & Trey for the idea, I stumbled upon their tweet while lurking on Twitter. So thanks!

I don’t like your script

sad dogo crying

Cool, I mean we are still friends right? Friends help friends avoid git mistakes, that’s why I wrote an accompanying text guide on How to undo anything in Git.

Share it with your friends, co-workers. No hard feelings

Peace ✌️

Update: Woke up to an email, that ugit was Featured on Changelog News, yay 🎉️

Update: I also covered a talk at GitHub India Constellation 2022, regarding the git tooling ecosystem & why we need a git-undo right now.