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.

Parity with auto-correct

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

Did you mean this?
> 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?

$ idid -2 !!
<runs git push>


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

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

  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.

  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.