bhupeshimself/ugit
ugit helps undo git commands. Your damage control git buddy. Undo from 20+ git scenarios.
287
Undo your last oopsie 🙈️ in git
Make sure your current directory is a git repository
docker run --rm -it -v $(pwd):/app bhupeshimself/ugit
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'
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
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
ugit
?git
command you wish to 'undo'.When | What |
---|---|
29 Oct, 2022 | ugit crossed 1k stars |
02 June, 2022 | console.dev featured ugit |
18 May, 2022 | I gave a talk about the git tooling ecosystem & git undo in Undo git, say whaat! - GitHub India Constellation, May 2022 |
12 May, 2021 | The guide was tweeted by GitHub (I was logging my research process there while building ugit) |
30 April, 2021 | Featured on Changelog News |
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.
You can read my in-process guide on How to undo anything in Git. You can also find this guide using ugit --guide
docker pull bhupeshimself/ugit