Add More Git Commands
Every now and then I find a super helpful nugget that I wish I'd known about long ago which is good because it's so simple. Extending the git
cli is one such nugget, you can basically add your own commands. All that's required is the name of the executing file must follow the format git-[sub command name]
such as:
git foo
As long as the file can be found within your PATH
variable then it will execute. So you can do:
touch git-foo
Then add the following contents to the new file:
#!/usr/bin/env bash
echo 'foo'
And then execute git foo
like the example at the start and foo
is written to the console.
There's a bit more on it here. Great stuff!