Custom git command to save/execute shortcuts on a per repo basis.
To ensure this script functions for each new bash shell:
- Save git-shortcut to (for example) /your-directory/git-custom-commands
- cd ~/
- touch .bash_profile
- Edit .bash_profile and add "export PATH=$PATH:/your-directory/git-custom-commands"
$ git shortuct ?# Create a simple shortcut
$ git shortuct -n "git status"
Shortcut added as #1
# Create and instantly run any shortcut
$ git shortuct -n -r "git status"
Shortcut added as #1
... git status runs
# Create shortcut with runtime parameters
# When running this shortcut, you can provide any value for <msg>
$ git shortuct -n "git commit -m <msg>"
Shortcut added as #2# List shortcuts first
$ git shortcut
Saved shortcuts:
1: git status
2: git commit -m <msg>
Enter shortcut number(s) to run (space delimited) [or nothing to cancel]:
# Run shortcut(s) immediately
$ git shortcut 1 2
... git status runs
... git commit -m <msg> runs
# Running a shortcut with runtime params
$ git shortcut 2
git commit -m <msg> [Ctrl+C to cancel | nothing to exclude param]
Enter value for param <msg>: Init commit
... git commit -m "Init commit" runs# List and select shortcut to edit
$ git shortcut -e# List and select shortcut to delete
$ git shortcut -d# Only list shortcuts
$ git shortcut -lPull requests are welcome! For major changes, please open an issue first to discuss what you would like to change.
Please make sure to check your modifications with ShellCheck.