Thursday, June 2, 2016

Yes, git, I did mean that

Git comes out of the box with a nice "auto correct" feature, but sometimes it's not correct. And other times, the first suggestion isn't the one you intended, but the second or third.

Here's a short, fun shell function (tested in zsh and bash) that will run your last git command and figure out what you meant to do and then run it for you.

https://gist.github.com/papaben/463d72bb4ea329754566fa82ef0c949e

Parity with auto-correct

$ git dif
git: 'dfif' is not a git command. See 'git --help'.

Did you mean this?
        diff
> idid !!
<shows diff>

Choose non-default auto-correct suggestion

$ git pu
git: 'pu' is not a git command. See 'git --help'.

Did you mean one of these?
        pull
        push
        p4

$ idid -2 !!
<runs git push>


6 comments:

  1. myTectra Placement Portal is a Web based portal brings Potentials Employers and myTectra Candidates on a common platform for placement assistance

    ReplyDelete
    Replies
    1. Great Article Cloud Computing Projects

      Networking Projects

      Final Year Projects for CSE

      JavaScript Training in Chennai

      JavaScript Training in Chennai

      The Angular Training covers a wide range of topics including Components, Angular Directives, Angular Services, Pipes, security fundamentals, Routing, and Angular programmability. The new Angular TRaining will lay the foundation you need to specialise in Single Page Application developer. Angular Training

      Delete
  2. There are too many information. I can't handle that. I need more time.

    ReplyDelete
  3. Thank you for sharing with us that you can use such a simple command in order to determine what you need and get the expected result.

    ReplyDelete
  4. I think that the instruction the author shared with us is pretty clear and easy to follow. I'll bookmark this page and check it out tomorrow again.

    ReplyDelete
  5. I'm stunned, I should say. Just for the most part do I go over a blog that is both educative and enamoring, and undeniably, you have nailed it. The issue is an issue that lacking people are talking unquestionably about. As of now i'm eager I revealed this during my benefit for something concerning this.
    kissasian

    ReplyDelete