Coder Social home page Coder Social logo

unixorn / ugit Goto Github PK

View Code? Open in Web Editor NEW

This project forked from bhupesh-v/ugit

2.0 2.0 0.0 174 KB

🚨️ ugit helps you undo your last git command. Your damage control git buddy. Powered by FZF

Home Page: https://bhupesh-v.github.io/undo-your-last-git-mistake-with-ugit/

License: MIT License

Shell 100.00%

ugit's Introduction

ugit

ugit logo

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

build ugit DeepSource License: MIT platform support linux and macos Twitter: bhupeshimself ugit demo: restore file gif

More Video Demos ✨️

Undo git add

ugit.git.add.demo.mp4

Undo git branch -D

ugit.git.branch.delete.demo.mp4

Undo git merge

ugit.git.merge.demo.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

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 tag (rename a tag)
  • Undo git rebase
  • Undo git cherry-pick
  • 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 πŸ’¬οΈ

Installation

Prerequisites

ugit dependencies:

  • Bash>=3
  • GNU utils like awk, grep, tput etc
  • fzf (Install latest version. Minimum required 0.21.0)

Manual Installation

  1. Install the script using curl

    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

    Or Arch Linux users can install ugit via AUR.

  2. Verify installation

    ugit --version

    Optionally run ugit --help to see help and management commands

    Undo your last oopsie in Git πŸ™ˆ
    Usage: ugit [-h] [-v] [-u]
    
    ugit helps you undo your last git command without much effort
    Just run 'ugit' and search for what you want to undo
    
    Available options:
    
    -h, --help      Print this help and exit
    -v, --version   Print current ugit version
    -u, --update    Update ugit
    
    Contact πŸ“¬: [email protected] for assistance
    Read the guide: https://bhupesh.gitbook.io/notes/git/how-to-undo-anything-in-git
    

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

ugit in ...

News

Community

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

πŸ‘€ Bhupesh Varshney

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

πŸ’» πŸ“– πŸ”Œ

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

ugit's People

Contributors

allcontributors[bot] avatar bhupesh-v avatar deepsourcebot avatar sharan-aithal avatar tabulatejarl8 avatar unixorn avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.