Is there any way to use these three commands in one?
git add .
git commit -a -m \"commit\" (do not need commit message either)
git push
Som
Since the question doesn't specify which shell, here's the eshell version based on the earlier answers. This goes in the eshell alias file, which might be in ~/.emacs.d/eshell/alias I've added the first part z https://github.com/rupa/z/ which let's you quickly cd to a directory, so that this can be run no matter what your current directory is.
alias census z cens; git add .; git commit -m "fast"; git push
This Result - Try this: Simple script one command for git add, git commit and git push
Open your CMD on Windows and paste this answer
git commit -m "your message" . && git push origin master
This example my picture screenshot : https://i.stack.imgur.com/2IZDe.jpg
You can use bash script , set alias to launch any command or group of commands
git commit -am "your message" && git push
If you use VSCode, you can download this extension which will let you do it in one simple keyboard shortcut.
If the file is already being tracked then you do not need to run git add
, you can simply write git commit -am 'your message'
If you do not want to write a commit message you might consider doing something like
git commit --allow-empty-message -am ''
Set as an alias in bash:
$ alias lazygit="git add .; git commit -a -m '...'; git push;";
Call it:
$ lazygit
(To make this alias permanent, you'd have to include it in your .bashrc or .bash_profile)