Git push with one command
Aug 31, 2022
I use this simple shortcut in my local development machine and some colleagues have asked me about it. It’s pretty simple but has saved me tons of time.
We are just adding, committing, and pushing to the remote repository with one command. The only thing that you have to do is update your ~/.bashrc or ~/.profile with the following code.
function g () {
git add -A && git commit -m "$1" && git push
}
You can then source your profile file like:
source ~/.bashrc
You can now simply:
g “I am awsome and I do not know what exactly I am committing to the branch”
PLEASE do use it carefully as commits ALL files: tracked and untracked.