Git command to commit all changes, including deleted or created files

After making changes to files already tracked git, I usually do a:

git commit -a -m "a message describing what you did"

followed by

git push origin master

to commit, and then click all the changes in my Github account. However, the first command does not work to add or delete files. To do this, I would first have to type:

git add -A

as indicated here: How to commit and push all changes, including deletion? .

In this other Git question, commit all files with a single command, the accepted answer indicates that the only way to apply full commit (i.e. including files added or deleted, not just edited), and then pressing it combined with the command &&as follows:

git add -A && git commit

which in my case will look like this:

git add -A && git commit -a -m "a message describing what you did" && git push origin master

Now for the question (s): is this big command right? Is there a way to create a new team gitto apply these three teams at the same time? In addition: is this due to the merger of teams recommended or discouraged? If yes, indicate the reason.


Edit

I immediately regret this decision: Edit the last message with the commit pressed .

+4
3

.

,

git config --global alias.commitall '!func(){ git add -A && git commit -am "$1" && git push origin HEAD; }; func'

,

git commitall "a message describing what you did"
+10

. . , / .

, git (, ), :

[alias]
acp = "!f(){ git add -A && git commit -am "$1" && git push origin master; };f"

git ( ~/.gitconfig) [alias]. - : git acp <message> .

, , * nix. , . git , .

+3
0

All Articles