Last Updated: August 15, 2019
·
1.996K
· kisukpark

Git number : Boost up your git command productivity!

If you...

  • Like to type all git command in terminal.
  • Are sick of typing all of file path when you want to git add or diff selectively?(Although current shells support auto completion.)

Then...

'git number' can be your secret weapon.

Fortunately I found this few months ago and I became a big fan of it.

Here is a link : github link


What is Git number?

'Git number' is a couple of scripts which make numbering to files shown up by 'git status'.

And you can do git command by its number, not file name.

For Example.

$ git number --column
# On branch master
# Untracked files:
#   (use "git add <file>..." to include in what will be committed)
#
#1      .README.swp
#2      README

'git number --column' is same as 'git status' in git number. I will make alias for this.

$ git number add 1
$ git number add 1 5
$ git number add 1-5

And you can add file like this. One file each, Several files each, Several files with range

This is AWESOME. Thanks holygeek.


How to use

Below explaination is following instruction from git hub link.

1. Clone the project

$ git clone https://github.com/holygeek/git-number.git  

2. Copy 3 scripts to one of your directory in system PATH.

In my case /usr/bin

$ cp git-list /usr/bin
$ cp git-number /usr/bin
$ cp git-id /usr/bin

3. Make alias for git commands

git status is same as

$ git number --column

and other commands are same as

$ git number <original git command> [parameters]

So I made alias for these in shell configuration file.

alias gs="git number --column"
alias ga="git number add"
alias gd="git number diff"
alias gr="git number reset"

4. Enjoy!

7 Responses
Add your response

have you tried git add -i ?

over 1 year ago ·

Thanks korin. I just got know about git add interactive mode. This also use numeric indexing and supports all of commands I mentioned above in one dashboard! : )

over 1 year ago ·

Thanks! Thats brilliant.

I have been searching for this for a while now, closest what I got was git fuzzy search which did not worked that well.

over 1 year ago ·

A better workflow is git add -i for untracked files and git add -p for staging diffs. With the latter you're also reviewing the contents of your commit so you're not blindly committing possibly unrelated changes.

I have both of these commands aliased to gai and gap respectively.

over 1 year ago ·

Yeah~ I will also add aliases for gai, gap. Thanks rane.

over 1 year ago ·

Spectacular! Is there support for adding multiple files in a single command? For example:

$git number add 1 3 4 8

over 1 year ago ·

@yogenzaga I edited my tip. Check it out. You can even use range!

over 1 year ago ·