ugit
ugit copied to clipboard
π¨οΈ ugit helps undo git commands. Your damage control git buddy. Undo from 20+ git scenarios.
ugit
Undo your last oopsie ποΈ in git
More Video Demos β¨οΈ
Undo git add
https://user-images.githubusercontent.com/34342551/121651365-29dbdc80-cab8-11eb-8c43-6d0c4b1509ad.mp4
Undo git branch -D
https://user-images.githubusercontent.com/34342551/121650985-c487eb80-cab7-11eb-9b6a-9257fa704d1c.mp4
Undo git merge
https://user-images.githubusercontent.com/34342551/121651071-d9fd1580-cab7-11eb-929d-d9359a64f0eb.mp4
More Video Demos β¨οΈ
Undo git add
https://user-images.githubusercontent.com/34342551/121651365-29dbdc80-cab8-11eb-8c43-6d0c4b1509ad.mp4
Undo git branch -D
https://user-images.githubusercontent.com/34342551/121650985-c487eb80-cab7-11eb-9b6a-9257fa704d1c.mp4
Undo git merge
https://user-images.githubusercontent.com/34342551/121651071-d9fd1580-cab7-11eb-929d-d9359a64f0eb.mp4
Why use ugit
?
- You ran an accidental
git
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)
- Because
ugit
is precise & uber cool !
Motivations behind writing ugit πββοΈοΈ
What's in the box ?
ugit
/git-undo
supports undoing following operations, some are a WIP. If you know of any other operations that can be undone and is not in the list, make sure to raise an issue or make a quick PR ποΈ
- [x] Undo
git commit
- [x] Undo
git add
- [x] Undo
git push
- [x] Undo
git branch -D
(branch delete) - [x] Undo
git pull
- [x] Undo
git reset
- [x] Undo
git tag -d
(tag delete) - [x] Undo
git stash apply
- [x] Undo
git stash pop/drop/clear
- [x] Undo accidental file delete (Restore a deleted file after a commit)
- [x] Undo (Restore) a file to a previous version
- [x] Undo
git merge
- [x] Undo
git cherry-pick
- [x] Undo
git tag
- [ ] Undo
git rebase
- [ ] Undo
git worktree remove
(recover deleted work-tree)
Contribute to the project by helping me with the above mentioned tasks.
If you have any other ideas/suggestions, do send them across. Hop in to ugit discussions π¬οΈ
News
When | What |
---|---|
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 |
Community
- Alexander Alemayhu made a youtube tutorial on Undoing Your Last Git Commit with Ugit
Installation
Prerequisites
ugit dependencies:
-
Bash >=
4.x.x
-
Git >=
2.23.0
-
fzf >=
0.21.0
- Installation guide - GNU utils like
awk
,grep
,tput
etc
Installation
Fig
Fig adds apps, shortcuts, and autocomplete to your existing terminal.
Install ugit
in just one click.
Linux
sh -c "$(curl -fsSL https://raw.githubusercontent.com/Bhupesh-V/ugit/master/install)"
Or Arch Linux users can install ugit via AUR.
Mac
brew install ugit
Windows
Using ugit on windows is still in experimental phases. You can use the new windows terminal + git bash to run ugit. Please read this thread for more info
ZSH Frameworks
Zgenom
If you're using Zgenom:
- Add
zgenom load Bhupesh-V/ugit
to your.zshrc
along with your otherzgenom load
commands. -
zgenom reset && zgenom save
Antigen
If you're using Antigen:
- Add
antigen bundle Bhupesh-V/ugit
to your.zshrc
where you've listed your other plugins. - Close and reopen your Terminal/iTerm window to refresh context and use the plugin. Alternatively, you can run
antigen bundle Bhupesh-V/ugit
in a running shell to haveantigen
load the new plugin.
Oh-My-ZSH
If you're using oh-my-zsh:
-
Clone the repository into a new
ugit
directory in oh-my-zsh's plugin folder:git clone https://github.com/Bhupesh-V/ugit.git $ZSH_CUSTOM/plugins/ugit
-
Edit your
~/.zshrc
and addugit
β same as clone directory β to the list of plugins to enable:plugins=( ... ugit )
-
Then, restart your terminal application to refresh context and use the plugin. Alternatively, you can source your current shell configuration:
source ~/.zshrc
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 configuration in your global .gitconfig
file:
[gc]
# default 90 days
reflogExpire = 200
Used to set how long records in a branches 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
Credit & Thanks
To all the SO threads that I will probably never visit again ;)
βΊοΈ Show your support
Support me by giving a βοΈ if this project helped you! or just
π License
Copyright Β© 2021 Bhupesh Varshney.
This project is MIT licensed.
π Contributing
Please read the CONTRIBUTING file for the process of submitting pull requests to us.
Contributors β¨
Thanks goes to these wonderful people (emoji key):
Sharan Aithal π» π |
Tabulate π» π¦ |
Joe Block π» π π |
CΓ©sar RomΓ‘n π» π |
Ilkin Bayramli π¦ |
Kopal Chakravarty π» |
Zorawar Purohit π |
This project follows the all-contributors specification. Contributions of any kind welcome!