ugit

ugit logo

Undo your last oopsie πŸ™ˆοΈ in git with ease

License: MIT platform support linux and macos bash love Twitter: bhupeshimself ugit demo gif

## 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 ## What's in the box `ugit` 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` - [ ] Undo `git tag` (rename a tag) - [ ] Undo `git rebase` - [ ] Undo `git cherry-pick` - [ ] Undo `git worktree remove` (recover deleted work-tree) ## Installation **ugit** dependencies: - `Bash`>=3 - GNU utils like `awk`, `grep`, `tput` etc - [fzf](https://github.com/junegunn/fzf) 1. Install the script using `wget` ```bash # Linux wget -q https://github.com/Bhupesh-V/ugit/releases/latest/download/ugit && chmod +x ugit && mv ugit $HOME/.local/bin/ # Mac wget -q https://github.com/Bhupesh-V/ugit/releases/latest/download/ugit && chmod +x ugit && mv ugit /usr/local/bin ``` or `curl` ```bash # Linux curl -fsSL https://github.com/Bhupesh-V/ugit/releases/latest/download/ugit -o ugit && chmod +x ugit && mv ugit $HOME/.local/bin/ # Mac curl -fsSL https://github.com/Bhupesh-V/ugit/releases/latest/download/ugit -o ugit && chmod +x ugit && mv ugit /usr/local/bin ``` 2. Verify installation ```bash ugit --version ``` Optionally run `ugit --help` to see help and management commands ## Please read ⚠️ Git comes with a garbage collector ([in case you didn't know](https://git-scm.com/docs/git-gc)) 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: ```gitconfig [gc] # default 90 days reflogExpire = 200 ``` Used to set how long records in a branches reflog should be preserved. ```gitconfig [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**](https://bhupesh.gitbook.io/notes/git/how-to-undo-anything-in-git) ## Author :bust_in_silhouette: **Bhupesh Varshney** - Web : [bhupesh-v.github.io](https://bhupesh-v.github.io) - Twitter : [@bhupeshimself](https://twitter.com/bhupeshimself) - DEV : [bhupesh](https://dev.to/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 [![Twitter URL](https://img.shields.io/twitter/url?style=social&url=https%3A%2F%2Fgithub.com%2FBhupesh-V%2Fugit%2F)](https://twitter.com/intent/tweet?url=https://github.com/Bhupesh-V/ugit&text=ugit%20via%20@bhupeshimself) [![Support via PayPal](https://cdn.rawgit.com/twolfson/paypal-github-button/1.0.0/dist/button.svg)](https://www.paypal.me/BhupeshVarshney/) ## πŸ“ License Copyright Β© 2021 [Bhupesh Varshney](https://github.com/Bhupesh-V).
This project is [MIT](https://github.com/Bhupesh-V/ugit/blob/master/LICENSE) licensed. ## πŸ‘‹ Contributing Please read the [CONTRIBUTING](CONTRIBUTING.md) file for the process of submitting pull requests to us. ## Contributors ✨ Thanks goes to these wonderful people ([emoji key](https://allcontributors.org/docs/en/emoji-key)):

Sharan Aithal

πŸ’» πŸ“–
This project follows the [all-contributors](https://github.com/all-contributors/all-contributors) specification. Contributions of any kind welcome!