Difference between Git commit modified and Git commit of a new file

I'm confused here ...

How do you do git commit for modified fileand how do you commit git for new file?

Also, how do you individually commit files in git?

+3
source share
1 answer

There are two parts to the git process. First, you “stage” individual files, and then execute the “commit” command, which actually adds the “delivered” files to the repository. Therefore, if you want to "stage" files, you will first use the "git add" command:

git add myfile1

, . "git status", . "" , , , "" , . , , , , "git commit", , . "-a" git commit (: , ).

:

, : file1.txt file2.txt git , :

# Changed but not updated:
#   (use "git add <file>..." to update what will be committed)
#   (use "git checkout -- <file>..." to discard changes in working directory)
#
#   modified:   file2.txt
#
# Untracked files:
#   (use "git add <file>..." to include in what will be committed)
#
#   file3.txt

, file2.txt, file3.txt, :

git add file2.txt
git add file3.txt
git commit

, , file2.txt

, , git commit -a file2.txt , (file3.txt) .

, :

git add file3.txt
git commit -a

, -a .

. git commit - "", .

+5

All Articles