• Stars
    star
    1,340
  • Rank 33,770 (Top 0.7 %)
  • Language
    Shell
  • License
    MIT License
  • Created about 3 years ago
  • Updated 3 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

🚨️ ugit helps undo git commands. Your damage control git buddy. Undo from 20+ git scenarios.

ugit

ugit logo

Undo your last oopsie 🙈️ in git

build ugit License: MIT total downloads (github + brew) platform support linux and macos git undo text guide Twitter: bhupeshimself

ugit demo: restore file gif

More Video Demos ✨️

Undo git add

undo-git-add.mp4

Undo git branch -D

undo-git-branch-delete.mp4

Undo git merge

undo-git-merge.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 💛️

  • 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
  • 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
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

Community

Installation

Prerequisites

ugit dependencies:

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

To use ugit on windows you need to install:

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

    scoop install fzf
    

    Alternatively, with Chocolatey:

    choco install fzf
    
  3. To use bash in terminal change your directory to **git\2.35.3.windows.1\bin\bash** accordingly.

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

Fig adds apps, shortcuts, and autocomplete to your existing terminal.

Install ugit in just one click.

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
Sharan Aithal

💻 📖
Tabulate
Tabulate

💻 📦
Joe Block
Joe Block

💻 📖 🔌
César Román
César Román

💻 🐛
Ilkin Bayramli
Ilkin Bayramli

📦
Kopal Chakravarty
Kopal Chakravarty

💻
Zorawar Purohit
Zorawar Purohit

📖
Nalin Singh
Nalin Singh

💻
vinayaknayar
vinayaknayar

📖
RohitSingh107
RohitSingh107

📦
Théotime Maillarbaux
Théotime Maillarbaux

💻 🐛
dr41d45
dr41d45

💻

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

More Repositories

1

30-seconds-of-cpp

30 Seconds of C++ (STL in C++). Read More about 30C++ here 👉
C++
1,419
star
2

tutorialdb

A search 🔎 engine for programming/dev tutorials,
Python
121
star
3

dotman

dotman is a simple, elegant & easy to use dotfiles manager 🖖🏽
Shell
105
star
4

til

Personal Wiki of Interesting things I learn every day at the intersection of software, life & stuff a.k.a my second brain 🧠️
Python
72
star
5

memer-action

A GitHub Action for Programmer Memes xD
Python
34
star
6

areyouok

A fast and easy to use URL health checker ⛑️ Keep your links healthy during tough times (Out of box support for GitHub Actions)
Go
31
star
7

defe

devfeed is a Tech feed Aggregator for Developers & Tech Enthusiasts
HTML
29
star
8

.Varshney

My config and dotfiles infrastructure ⚒️
Shell
28
star
9

zoe

A barebones transactional in-memory key: value store with a REPL [For educational purposes]
Go
21
star
10

awesome-dev.to

[UNMAINTAINED] A collection of awesome blog series on DEV.to
Python
17
star
11

update-pr-reminder-action

A github action to automatically remind contributors to update their branch when there is a new commit in the base branch
Shell
9
star
12

Learn-Python-Packages

Jupyter notebooks of different python packages like opencv, numpy, PIL (Pillow) etc
Jupyter Notebook
8
star
13

todohub

[UNMAINTAINED] Create a to-do ✅ list from GitHub issues.
HTML
7
star
14

CoderBot

[UNMAINTAINED] A Telegram Bot for Beginners to learn Programming.
JavaScript
4
star
15

sample-project

This is a template repository which you can use for creating Projects on GitHub.
4
star
16

Bhupesh-V.github.io

My Internet Home ❤️
SCSS
2
star
17

tools-i-use

Tools that help me ease up my life
2
star
18

ratelimiter-demo

A Go app to demonstrate API Rate Limiting using Leaky Bucket Algorithm (WIP)
Go
2
star
19

Bhupesh-V

Its me Bhupesh Varshney, Also scroll down for memes :)
Python
1
star