light01
light01

Reputation: 245

Any way to get line numbers for git status

Is there any plugin/module for command line git that would display "line numbers" for git status and assign each file path to a number? Something like this:

1. modified:   projectx/src/lib/config.cpp
2. modified:   projectx/modules/somefile.h
3. modified:   projectx/longfilename/subfile/file.x

Reason I'm asking for this, is, because it can get annoying to type the whole file path (even using tab for auto completion), especially when it's a really long file path. Then using the number for anything that needs to be done with the file, git add 1. git checkout 2. or something like that. I'm not that familiar with git to know all tricks it can do, I'm just a basic user, but I think something like this would speed things up.

Upvotes: 1

Views: 83

Answers (1)

Romain Valeri
Romain Valeri

Reputation: 22027

In some terminals (Git Bash among others) you can double-click any string* (here, the long file path, but it could be a branch name or anything else) and it will be selected and copied.

After that you just have to right-click to paste it where your cursor is. Very convenient when available.

* (very common scenario : when doing an "add", typically you just did a "status" before that and have a display of modified files)

Upvotes: 1

Related Questions