All articles
git

How to setup bash auto completion(GIT & NPM) on Windows

Share this article

Share on LinkedIn Share on X (formerly Twitter)

Open Git bash.
I assume that you have VS Code installed on your PC. Run the following commands:

code ~/.git-completion.bash
 
code ~/.bashrc

And fill the files with the following contents

source ~/.npm-completion.bash
 
source ~/.git-completion.bash

For .git-completion.bash file contents refer this site

For npm completions, run the following command in your terminal which will auto populate the npm-completion.bash file:

npm completion >> ~/.npm-completion.bash

Logout and Login

Close the instance of Git Bash and reopen it.

Test

Now go to any node package folder

Type npm run and hit TAB key twice

The terminal should now log all the scripts that you can run for that package


Comments