Undo your last oopsie ๐๏ธ in git
See 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 ugit
- You did an accidental
git
command you didn't want to.
- You don't want to waste your time searching on how to undo โฆ
- Because
ugit
is cool
Motivations behind writing ugit ๐โโ๏ธ๏ธ
What's in the box
See 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
ugit
git
command you didn't want to.ugit
is coolugit
/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 send 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
- [ ] Undo
git tag
(rename a tag) - [ ] Undo
git rebase
- [ ] Undo
git worktree remove
(recover deleted work-tree)
Help me finish above tasks by contributing?
Have any other ideas/suggestions? Hop in to ugit discussions ๐ฌ๏ธ
ugit
in โฆ
News
- Featured on Changelog News
- The guide was tweeted by GitHub (I was logging my research process there while building ugit)
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
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
Author
:bustinsilhouette: Bhupesh Varshney
- Web : bhupesh-v.github.io
- Twitter : @bhupeshimself
- DEV : bhupesh
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 ๐ป ๐ |
This project follows the all-contributors specification. Contributions of any kind welcome!