Sign inSign up

bhupeshimself/ugit

By bhupeshimself

•Updated over 2 years ago

ugit helps undo git commands. Your damage control git buddy. Undo from 20+ git scenarios.

Image
Developer tools
2

3.1K

bhupeshimself/ugit repository overview

⁠ugit

ugit logo

⁠Undo your last oopsie 🙈️ in git

build ugit ⁠ License: MIT ⁠ total downloads (github + brew) platform support linux and macos ⁠ git undo text guide ⁠ Twitter: bhupeshimself ⁠

ugit demo: restore file gif

⁠Usage

Make sure your current directory is a git repository

⁠Linux/Mac

docker run --rm -it -v $(pwd):/app bhupeshimself/ugit
⁠Set an alias for easy access
⁠Shell alias

alias ugit="docker run --rm -it -v $(pwd):/app bhupeshimself/ugit"

⁠Git alias

git config --global alias.undo '!docker run --rm -it -v $(pwd):/app bhupeshimself/ugit'

⁠Common Issues

If you come across the error Ummm, you are not inside a Git repo 😟 while executing the container, try sharing the file/directory permissions like this:

docker run --rm -it -u $(id -u):$(id -g) -v $PWD:/app bhupeshimself/ugit

⁠Windows

Make sure you have switched to Linux containers on docker desktop⁠.

# powershell
docker run --rm -it -v ${PWD}:/app bhupeshimself/ugit
# cmd
docker run --rm -it -v %cd%:/app bhupeshimself/ugit

⁠Why use ugit?

  • You accidentally ran agit command you wish to 'undo'.
  • You want to save time by not searching for how to undo ...
  • Your focus is on problems at hand and not on Git (avoid context switching)

⁠News

WhenWhat
29 Oct, 2022ugit crossed 1k stars
02 June, 2022console.dev⁠ featured ugit⁠
18 May, 2022I gave a talk about the git tooling ecosystem & git undo in Undo git, say whaat! - GitHub India Constellation, May 2022⁠
12 May, 2021The guide was tweeted by GitHub⁠ (I was logging my research process there while building ugit)
30 April, 2021Featured on Changelog News⁠

⁠Community

⁠Please read ⚠️

Git comes with a garbage collector (in case you didn't know⁠) therefore undoing some commands will become impossible if the entries are deleted from the reflog. One way to prevent this is to increase default time limits before the reflog entries expire.

Add these configurations in your global .gitconfig file:

[gc]
    # default 90 days
    reflogExpire = 200

Used to set how long records in a branch's reflog should be preserved.

[gc]
    # default 30 days
    reflogExpireUnreachable = 90

Used to set how long inaccessible reflog records should be preserved.

⁠Not satisfied?

You can read my in-process guide on How to undo anything in Git⁠. You can also find this guide using ugit --guide

Tag summary

Content type

Image

Digest

sha256:b4a8dc331…

Size

7.7 MB

Last updated

over 2 years ago

docker pull bhupeshimself/ugit