🚨️ ugit helps undo git commands. Your damage control git buddy. Undo from 20+ git scenarios.
See the code
Undo your last oopsie 🙈️ in gitgit addgit branch -Dgit mergeugit?git command you wish to 'undo'.ugit/git-undo supports undoing the following operations, some are a WIP. If you know of any other operations that can be undone and are not in the list, make sure to raise an issue or make a quick PR 💛️
git commitgit addgit pushgit branch -D (branch delete)git pullgit resetgit tag -d (tag delete)git stash applygit stash pop/drop/cleargit mergegit cherry-pickgit taggit rebasegit 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 💬️
| 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 |
docker pull bhupeshimself/ugit
docker run --rm -it -v $(pwd):/app bhupeshimself/ugit
ugit dependencies:
4.x.x2.23.00.21.0 - Installation guideawk, grep, tput etcsh -c "$(curl -fsSL https://raw.githubusercontent.com/Bhupesh-V/ugit/master/install)"
Arch Linux users can install ugit via AUR.
brew install ugit
To use ugit on Windows you need to install:
Git Bash
Git bash comes with git (if you have installed it on your machine then no need). To install git (preferably with scoop):
scoop install git
FZF
scoop install fzf
Alternatively, with Chocolatey:
choco install fzf
To use bash in terminal change your directory to **git\2.35.3.windows.1\bin\bash** accordingly.
Then either clone the repo,
git clone https://github.com/Bhupesh-V/ugit.git
or get it using curl:
sh -c "$(curl -fsSL https://raw.githubusercontent.com/Bhupesh-V/ugit/master/install)"
Fig adds apps, shortcuts, and autocomplete to your existing terminal.
Install ugit in just one click.
If you're using Zgenom:
zgenom load Bhupesh-V/ugit to your .zshrc along with your other zgenom load commands.zgenom reset && zgenom saveIf you're using Antigen:
antigen bundle Bhupesh-V/ugit to your .zshrc where you've listed your other plugins.antigen bundle Bhupesh-V/ugit in a running shell to have antigen load the new plugin.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 add ugit – 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
git-undo Command ConflictIf you have both ugit and git-extras (https://github.com/tj/git-extras) installed, be aware that both provide a git-undo command. This can lead to conflicts, as only one version of the command will be accessible at a time. To resolve this:
Using Homebrew: Homebrew will notify you of the conflict during installation. You can choose to unlink the conflicting formula or use the --overwrite flag to force the link as follows:
brew link --overwrite ugit
Manual Installation: Ensure that the git-undo command from the desired package is prioritized in your system's PATH.
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 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
To all the SO threads that I will probably never visit again ;)
Support me by giving a ⭐️ if this project helped you! or just
Copyright © 2021 Bhupesh Varshney.
This project is MIT licensed.
Please read the CONTRIBUTING file for the process of submitting pull requests to us.
Thanks goes to these wonderful people (emoji key):
Sharan Aithal 💻 📖 | Tabulate 💻 📦 | Joe Block 💻 📖 🔌 | César Román 💻 🐛 | Ilkin Bayramli 📦 | Kopal Chakravarty 💻 | Zorawar Purohit 📖 |
Nalin Singh 💻 | vinayaknayar 📖 | RohitSingh107 📦 | Théotime Maillarbaux 💻 🐛 | dr41d45 💻 | Taebok Joseph Kim 💻 | luxxmr 📖 |
This project follows the all-contributors specification. Contributions of any kind welcome!
1,053 followers · starred Jun 2022
443 followers · starred Jun 2022
275 followers · starred May 2021
30 followers · starred Feb 2024
🚨️ ugit helps undo git commands. Your damage control git buddy. Undo from 20+ git scenarios.
See the code
Undo your last oopsie 🙈️ in gitgit addgit branch -Dgit mergeugit?git command you wish to 'undo'.ugit/git-undo supports undoing the following operations, some are a WIP. If you know of any other operations that can be undone and are not in the list, make sure to raise an issue or make a quick PR 💛️
git commitgit addgit pushgit branch -D (branch delete)git pullgit resetgit tag -d (tag delete)git stash applygit stash pop/drop/cleargit mergegit cherry-pickgit taggit rebasegit 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 💬️
| 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 |
docker pull bhupeshimself/ugit
docker run --rm -it -v $(pwd):/app bhupeshimself/ugit
ugit dependencies:
4.x.x2.23.00.21.0 - Installation guideawk, grep, tput etcsh -c "$(curl -fsSL https://raw.githubusercontent.com/Bhupesh-V/ugit/master/install)"
Arch Linux users can install ugit via AUR.
brew install ugit
To use ugit on Windows you need to install:
Git Bash
Git bash comes with git (if you have installed it on your machine then no need). To install git (preferably with scoop):
scoop install git
FZF
scoop install fzf
Alternatively, with Chocolatey:
choco install fzf
To use bash in terminal change your directory to **git\2.35.3.windows.1\bin\bash** accordingly.
Then either clone the repo,
git clone https://github.com/Bhupesh-V/ugit.git
or get it using curl:
sh -c "$(curl -fsSL https://raw.githubusercontent.com/Bhupesh-V/ugit/master/install)"
Fig adds apps, shortcuts, and autocomplete to your existing terminal.
Install ugit in just one click.
If you're using Zgenom:
zgenom load Bhupesh-V/ugit to your .zshrc along with your other zgenom load commands.zgenom reset && zgenom saveIf you're using Antigen:
antigen bundle Bhupesh-V/ugit to your .zshrc where you've listed your other plugins.antigen bundle Bhupesh-V/ugit in a running shell to have antigen load the new plugin.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 add ugit – 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
git-undo Command ConflictIf you have both ugit and git-extras (https://github.com/tj/git-extras) installed, be aware that both provide a git-undo command. This can lead to conflicts, as only one version of the command will be accessible at a time. To resolve this:
Using Homebrew: Homebrew will notify you of the conflict during installation. You can choose to unlink the conflicting formula or use the --overwrite flag to force the link as follows:
brew link --overwrite ugit
Manual Installation: Ensure that the git-undo command from the desired package is prioritized in your system's PATH.
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 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
To all the SO threads that I will probably never visit again ;)
Support me by giving a ⭐️ if this project helped you! or just
Copyright © 2021 Bhupesh Varshney.
This project is MIT licensed.
Please read the CONTRIBUTING file for the process of submitting pull requests to us.
Thanks goes to these wonderful people (emoji key):
Sharan Aithal 💻 📖 | Tabulate 💻 📦 | Joe Block 💻 📖 🔌 | César Román 💻 🐛 | Ilkin Bayramli 📦 | Kopal Chakravarty 💻 | Zorawar Purohit 📖 |
Nalin Singh 💻 | vinayaknayar 📖 | RohitSingh107 📦 | Théotime Maillarbaux 💻 🐛 | dr41d45 💻 | Taebok Joseph Kim 💻 | luxxmr 📖 |
This project follows the all-contributors specification. Contributions of any kind welcome!
1,053 followers · starred Jun 2022
443 followers · starred Jun 2022
275 followers · starred May 2021
30 followers · starred Feb 2024