For smaller personal projects, sometimes I just want to make an instant snapshot of the project, so that I don't lost any files or won't messed up the file contents and can't get it back.
So I hope to have a command that will add all files in the current project (no matter which directory I am in within the project directories), commit them, and push it to a remote server, be it github or gitlab.
Is the following a good way to do it; is there a better way?
alias gitokpush='git add --all :/ && git com -am "ok" && git push'
For the record, :/ means for the whole working directory (the very top), because git add . only adds all files in the current directory and underneath, not necessarily everything from the very top.
You can also use a git alias:
git config --global alias.okpush '!'git add --all :/ && git com -am \"ok\" && git push'
Then a git okpush would be enough.
Even shorter (and allowing a custom message)
git config --global alias.cam '!git commit -a -m '
Then: git cam "ok"
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With