g is a Bash function - g g is a shortcut for git (i.e.: 'g status' = 'git status') and a preprocessor with option switches for my most commonly used git commands
Use this and customize it with your most used git commands. I use this as a menu to remind my old man brain what I need to do next and what options I have to execute.
Used / created for macOS bash but can be modified for other OS.
When you execute g() without parameters you will get the following:
This option performs the following operations:
- git add .
- git commit -m ""
- git push (if remote repo defined)
The commit message can be specified on the command line i.e.: g u "" This message will be appended with the stagged filenames, i.e.: "[a-macbook]:README.md; Updated README.md file" Optionaly I have include bash comments with the same code to prepend date and machine name as well.
This option adds a file to the .gitignore file using the following syntax: g ignore
Here are some 'git log' options that I commonly use:
l | log = git log --name-status
1 | 1liner = git log --oneline
lf | logfind = git log --grep <string>