Git add autocomplete file name

I am working on a git project. Since I have a lot of folder depth, I would like to improve my autocompletion to work with file names, not just paths.

Here is an example:

$git status 1 ↡ ✹master 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: app/src/main/java/fr/pasteque/client/BaseFlavor.java modified: app/src/main/java/fr/pasteque/client/widgets/RestaurantTicketsAdapter.java no changes added to commit (use "git add" and/or "git commit -a") 

I obviously have to add the file using

git add app/src/main/java/fr/pasteque/client/BaseFlavor.java

But I would like to write: git add BaseFlavor.java

git add **/BaseFlavor.java works!

But the completion, for example git add **/Base<tab> , is not ...

Any ideas on how it might work with completion?

Thanks in advance!

+5
source share
3 answers

Try git add **/Base*<tab> (note the extra * ).

+1
source

This is a very convenient bash script that can help you: http://code-worrier.com/blog/autocomplete-git/

You cannot use git add **/filename* , but git add <tab> offers you only files and paths that you are ready to commit, not track, merge conflicts, etc.

0
source

I know that this is not an exact answer to the question, but there is a very convenient tool from Facebook - PathPicker - you can simply select the modified files that you want to add.

0
source

All Articles