One GIT command to rule them all (gacp: git-add-commit-push)
git add -A git commit -m "$MESSAGE" git push origin master
All with a single command.
gacp > My message CONTENTS OF COMMIT CONTENTS OF PUSH
Can this be done? Could someone share some sample code? Is there a native git function that can do this?
4 Solutions collect form web for “One GIT command to rule them all (gacp: git-add-commit-push)”
If you are on linux, just write a shell script or create an alias
#!/usr/bin/sh set -x # Output executed commands set -e # Make script fail as soon as one command fails read MESSAGE git add -A git commit -m "$MESSAGE" git push origin master
on my windows machine . i have set up this bashrc alias to make the entire process more simple.
create / locate your .bashrc – refer stack overflow thread
add the following line to file
alias gacp=’echo “enter commit message : ” && read MSG && git add . && git commit -m “$MSG” && git push’
reload .bashrc / close and reopen your shell
- now you can do the entire process with gacp command .
The first two commands can be launch with :
git commit -a -m "$MESSAGE"
Then, you can check other commands :
git pull --rebase git rebase -i
before to do a git push.
Refer to the answer here: git add, commit and push commands in one?
You can try gitu.
For the first time (node js has to be installed):
npm install -g git-upload
To issue those three commands at once.
The good thing is that you don’t have to worry when you reinstall your system or when you want to do this on different computers and No file modification is needed.
This also work on different platforms (not just Linux and Mac, but also Windows) just that you have to install
git of course).