With Liao Xuefeng learning git (1.0)

Git is the world's most advanced distributed version control system


git config --global user.name "Your Name"
git config --global user.email "[email protected]"

The above code, command --globalparameter indicates all of the Git repository on your machine will use this configuration.


pwd

Command is used to display the working directory path name, full name is "Print Working Directory"


By git initcommand becomes the catalog can manage Git repository, as follows, enter:

git init

Output is as follows:

Initialized empty Git repository in C:/Users/Re:CREATORS/Cortana/.git/

Current directory more than a .git directory, and this directory is to track and manage Git repository.

If you do not see the .gitdirectory, it is because this directory is hidden by default, with the following code can be seen:

ls -ah

Git add command tells Git, to add files to the repository:

git add readme.txt

Command git committells Git, the submission of documents to the repository:

git commit -m "wrote a readme file"

git commitCommand, -mentered followed by explanation of this submission, you can enter any of the content, of course, the best is meaningful, so you can from the history list easy to find change records

The code output is as follows:

[master (root-commit) 32f63de] wrote a readme file
1 file changed, 3 insertions(+)
create mode 100644 readme.txt

git commitAfter the successful implementation of the command will tell you 1 file changed: a file is changed (we readme.txt file newly added); : 2 insertionsinsert the two lines (readme.txt have two lines).


Why add files Git needs add, commita total of two steps it? Because commitit can submit many files at once, so you can multiple adddifferent files, such as:

git add file1.txt
git add file2.txt file3.txt
git commit -m "add 3 files"

summary

Summarize the contents of two learned today:

Initialize a Git repository, use the git initcommand.

Add files to the Git repository, in two steps:

  1. Using the command git add <file>, pay attention, it can be used repeatedly to add multiple files;
  2. Use the command git commit -m <message>to complete.

Guess you like

Origin blog.csdn.net/qq_40061206/article/details/94478767