This is "undo" for git. Amazing.
Go to file
Bhupesh Varshney 01d3c5fc6d
improve docs
- add 1 more community link
- 1 more reason to use ugit
2022-07-11 12:32:44 +05:30
.github remove ko-fi from funding 2022-06-08 19:47:32 +05:30
.all-contributorsrc docs: update .all-contributorsrc [skip ci] 2022-06-15 17:05:57 +00:00
.deepsource.toml Add .deepsource.toml 2021-05-14 06:56:07 +00:00
.gitignore Initial commit 2021-04-10 11:48:48 +05:30
CODE_OF_CONDUCT.md Initial commit 2021-04-10 11:48:48 +05:30
CONTRIBUTING.md 💩 use better version to restore files 2021-04-30 19:53:06 +05:30
git-undo Add symlink to git-undo 2021-05-19 11:33:13 -06:00
install 🔧 add support for setting up gitconfig while installing (linux only) 2022-06-07 20:08:41 +05:30
LICENSE Initial commit 2021-04-10 11:48:48 +05:30
README.md improve docs 2022-07-11 12:32:44 +05:30
ugit bump version 2022-02-18 11:56:55 +05:30
ugit.plugin.zsh Add shebang to plugin file to make linting easier 2021-05-19 09:42:55 -06:00

ugit

ugit logo

Undo your last oopsie 🙈️ in git

build ugit License: MIT GitHub all releases platform support linux and macos git undo text guide Twitter: bhupeshimself

ugit demo: restore file gif

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 ugit

  • You ran an accidental git command you didn't want to.
  • You don't want to waste your time searching on how to undo ...
  • Because you want to focus on problems at hand and not on Git (You don't like context switching)
  • Because ugit is 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 send a quick PR 💛

  • Undo git commit
  • Undo git add
  • Undo git push
  • Undo git branch -D (branch delete)
  • Undo git pull
  • Undo git reset
  • Undo git tag -d (tag delete)
  • Undo git stash apply
  • Undo git stash pop/drop/clear
  • Undo accidental file delete (Restore a deleted file after a commit)
  • Undo (Restore) a file to a previous version
  • Undo git merge
  • 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 💬

News

Community

Installation

Prerequisites

ugit dependencies:

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:

  1. Add zgenom load Bhupesh-V/ugit to your .zshrc along with your other zgenom load commands.
  2. zgenom reset && zgenom save

Antigen

If you're using Antigen:

  1. Add antigen bundle Bhupesh-V/ugit to your .zshrc where you've listed your other plugins.
  2. 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 have antigen load the new plugin.

Oh-My-ZSH

If you're using oh-my-zsh:

  1. 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

  2. Edit your ~/.zshrc and add ugit same as clone directory to the list of plugins to enable:

    plugins=( ... ugit )

  3. 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 Twitter URL

Support via PayPal

📝 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

📦

This project follows the all-contributors specification. Contributions of any kind welcome!