How to commit and push all changes, including additions, editions, and file deletions etc in one command?
Asked
Active
Viewed 5.3k times
6 Answers
29
You will have to do git add -A
to add all files new files, changes and removed files. Than follow that up with git commit
and git push
19
Use the following commands-
git add -A
to add all files new files, changes and removed files.git commit -m "Your message"
to save the changes done in the files.git push -u origin master
to send your committed changes to a remote repository, where the local branch is named master to the remote named origin
4
please follow these command git commit -am "message" (to add and commit in single command) git push origin [branch Name]

Gaurav Rathi
- 47
- 1
-
`commit -a` updates existing files but it does not add new files. See `git help commit` or try it. – Asclepius Oct 18 '20 at 02:32
0
Can you please try the following
git commit -a

Sandeep Nair
- 3,630
- 3
- 26
- 38
-
1If there are new files not added to the repository yet, you still have to `git add` them. – ohaal Feb 17 '12 at 13:44
-1
As I understand your question you are asking about "-u" option used as below which will add all already existing in repo entries (but no new ones):
git add -u
which accordingly to man pages:
-u, --update Update the index just where it already has an entry matching <pathspec>. This removes as well as modifies index entries to match the working tree, but adds no new files. If no <pathspec> is given when -u option is used, all tracked files in the entire working tree are updated (old versions of Git used to limit the update to the current directory and its subdirectories).

mironq
- 346
- 1
- 3
- 9