Git Aliases

If there is a Git command you seem to be using frequently, consider using an alias to do so. Aliases come in many different shapes, and you can choose whichever you like. An alias is nothing more than a shorthand for a command, and Git has its own feature this.

An example if you want to track the generated files (.js and .js.map) for a Typescript project in any directory, you could use the following:

git config alias.add-tsc 'add dir/**/*.js*'

Or add --global if you want to use it across projects:

git config --global alias.add-tsc 'add dir/**/*.js*'

To list all your aliases, use git config -l or git config -l --global for the global scope.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.