Theoretical git tutorial, view the status and history of work submitted

git configuration

Git successfully installed the first thing is to let children know who the owner!

This operation is very important because every Git submit to the will use this information, once determined can not be changed

Enter the following command) in the command line mode:

 

1. > git config - , Ltd. Free Join . The User name "I am the rain acridine" 
2. > git config - , Ltd. Free Join . The User Email "[email protected]"

Note: The contents of double quotation marks instead of their own information (⊙o⊙) Oh, or you can be the future of labor necessary to count my head up -

Use git config --list command to see whether the information written to success

 

git theoretical basis

Your local Git repository has maintained three "tree" form, which is the core framework of Git.

This three trees are: the work area, staging area and Git repository

 

Work area (Working Directory) is where you normally store the project code.

Staging area (Stage) for temporary storage of your changes, in fact it's just a file, save the file list of information to be submitted.

Git repository (Repository) is a safe storage location of the data, this side has submitted all versions of your data. Which, HEAD point to the latest version into the repository (this third tree, to be exact, it should be pointed Git repository HEAD version).

OK, Git workflow is generally Jiang Zi:

. \ 1 in the working directory to add, modify files;

. \ 2 will need to be versioned files in the staging area;

\ 3 The documents submitted to the staging area to the Git repository.

Therefore, Git managed file has three states: modified (modified), has been staging (staged) and has been submitted (committed), in turn corresponds to the top of every process.

 

 

Use git

1. Create a folder on the local git_home git used to store content

1.win + R open cmd command line, open the folder command line git_home

2. Run, git init

3. This time view git_home folder, if you see .git folder in a hidden folder then the success it

ps:

Options can click on a folder, show hidden folders

 

 

 

2. Place the file into the working directory git repository requires only two steps:

1.-git add filename

2.-git commit -m "what have you done" (a simple comment, it is best not to use Chinese)

 

 

 

3. Check the status

git status: check the current status of git

a. When you store the file into the new folder in git_home, use this command to view, at this time of the folder name will be displayed in red

b. When you execute the command -git add the file name and then execute the command, and the folder name is displayed in green, while indicating that the file can be commit.

 

 

4. recovery

git reset HEAD: last command to be submitted back to the staging area

git reset HEAD ~: that the last command before the command to be submitted back to the staging area

5. When the file is already in the staging area, and you edited the file, that local and regional staging folder with the same name does not match, run the following two commands:

1.git checkout - filename

The staging area file overwrite local files with the same name

2.git add the file name

The revised document covers the staging area of ​​the same name

3. Finally, perform commit. (-Git commit -m "what have you done" (a simple comment, it is best not to use Chinese))

 

  1. View Log

    git log commit record to view history

    log in chronological ordering from near to far

    While providing convenient versions prior to version id you back

 

 

 

 

 

Guess you like

Origin www.cnblogs.com/pythonyeyu/p/10951145.html