Improving your Git workflow since 2013.
Nit is a thin command-line wrapper for git. It gives you handy shortcuts for your everyday work with git, reduces your typing and is easily extendable with your own commands.
gem install nit
This will install the
nit shell command.
nit command will be your best friend.
git status on LSD.
# On branch master # Changes not staged for commit: # (use "git add <file>..." to update what will be committed) # (use "git checkout -- <file>..." to discard changes in working directory) # # modified: on_stage.rb [a] # modified: staged.rb [b] # # Untracked files: # (use "git add <file>..." to include in what will be committed) # # brandnew.rb [c] # new.rb [d]
First of all, it shows you the current branch in bold.
Secondly, the status screen renders a file index for each file which can be used on the command-line.
Indexes per default are characters on the right-hand side of the filename.
# modified: on_stage.rb [a]
This can be configured, in case you prefer digits.
# modified: on_stage.rb 
You can also have the indexes prepended to the filename.
# modified: [a] on_stage.rb
To commit files, you no longer use the filename but their indexes.
nit commit a c
Which will run
git add on_stage.rb git add brandnew.rb git commit
Note that nits adds and commits an already staged file and an untracked file in the same step.
This could also be run as
nit commit ac
Nit will extract the correct indexes.
Auto-Expansion Of Commands
You don't have to type
nit commit everytime. Use a short-cut, nit figures out what command you want. This command will work, too.
nit co abc
Adding with nit becomes obsolete. It is handled by the
When files on the status screen get in your way you can ignore them. Nit will simply not consider them anymore until you
Ignoring files is roughly equivalent to
git stash. However, instead of having to remember dozens of stashes, you simply tell nit to hide files from your status. That helps focusing on the files you are actually working on. Trust us.
nit ignore a d
This tells nit to ignore
$ nit # On branch master # Changes not staged for commit: # (use "git add <file>..." to update what will be committed) # (use "git checkout -- <file>..." to discard changes in working directory) # # modified: staged.rb [a] # # Untracked files: # (use "git add <file>..." to include in what will be committed) # # brandnew.rb [b] # # Ignored files: 2
The ignored files are now longer visible. However, the last line reminds you that there are files ignored.
To get a list of ignored files, run:
[a] on_stage.rb [b] new.rb
If you want to commit to the ignored files, just unignore them, again.
nit unignore a
To push your changes, run the following command.
Will figure out the current branch and run
git push origin <current branch>
push accept command-line options, so this will push your tags as well, if you're releasing.
nit push --tags
The same works for
You can use nit's index interpolation for any git command.
nit diff ab
Some operations require nit to save application state. This is done in the
.nit YAML file in your working directory. You can manually edit it.
You can have number-based indexing.
modified: on_stage.rb  modified: staged.rb 
indexer = "IntegerIndexer"
Some people prefer the index prepending the file name.
modified:  on_stage.rb modified:  staged.rb
Nap in the park.
index_renderer = "PrependIndexRenderer"
However, scientific studies with
nit over the last 18 years have proven that characters instead of digits are faster to reach when typing. Also, indexes appended to the filename make them easier to read when deciding what to commit.
Extending nit with your own commands can be done either with gems or by placing the extensions into your
.nit directory. This will be implemented and documented soon.
There are plenty of more features planned for the upcoming versions.
Copyright (c) 2013, Nick Sutterer [email protected]
Released under the MIT License.