Giter VIP home page Giter VIP logo

git-fixup's Introduction

git fixup

Quickly fix up an old commit using your currently-staged changes.

usage

Usage

After installation, just run git fixup or git squash to perform the related actions.

By default, git fixup checks for staged changes and offers to amend an old commit.

Given a repo that looks like:

linear-repo

Running git fixup will allow you to edit an old commit:

linear-repo-fixup

The default behavior will check if your current HEAD commit has an upstream branch and show you only the commits between where you currently are and that commit. If there is no upstream for HEAD you will see the behavior above.

If you're using a pull-request workflow (e.g. github) you will often have repos that look more like this:

full-repo

You can set GIT_INSTAFIX_UPSTREAM to a branch name and git fixup will only show changes between HEAD and the merge-base:

full-repo-fixup

In general this is just what you want, since you probably shouldn't be editing commits that other people are working off of.

After you select the commit to edit, git fixup will apply your staged changes to that commit without any further prompting or work from you.

git-squash is just a symlink to git-fixup installed by brew, but if you invoke it (either as git-squash or git squash) it will behave the same, asking you which change to amend, but after you have selected the commit to git will give you a chance to edit the commit message before changing the tree at that point.

Installation

If you're on macos or linux and using homebrew you should be able to do:

brew install quodlibetor/git-fixup/git-fixup

Otherwise, you will need to compile with Rust. Install rust, clone this repo, build, and then copy the binary into your bin dir:

curl https://sh.rustup.rs -sSf | sh
git clone https://github.com/quodlibetor/git-fixup && cd git-fixup
cargo build --release
cp target/release/git-fixup /usr/local/bin/git-fixup

License

git-fixup is licensed under either of

at your option.

Patches and bug reports welcome!

git-fixup's People

Contributors

quodlibetor avatar

Watchers

 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.