Full learning git two git staging area

Source: Internet
Author: User
Tags git commands

1 git log command to view commit log information

git log--pretty-fuller #详细查看

git log--stat #查看每次提交的文件变更

git log--pretty-online

2git diff vs. File modification information

git diff HEAD git Add. Comparison with the head pointer of the current repository

git diff--cached or--staged commit file differences in staging area and repository

How Git commands affect workspaces and staging area

The left side is the repository for the right side of the workspace. Staging area, marked as index in the repository, is the directory tree represented by the master branch

Head is the head that appears in a cursor graph pointing to the master branch can be replaced with master

The object library objects as Git in the figure is actually located in the. Git/objects Directory

When you execute the git add command on a workspace modification (or new) file, the staging area directory tree is updated and the contents of the workspace modified (or added) are written to a new object in the object library and the ID of the object is recorded in the staging area index file

When a commit commit is committed, the staging area tree writes that the master branch in the current repository (object library) will update, that is, the directory tree to which master is most recent is the directory tree at the time of submission staging area

When executing git reset head, the staging area tree will be rewritten and replaced by the directory tree pointed to by Maste, but the workspace will not change.

When you execute git rm--cached (filename), the file is deleted directly from staging area but the workspace is unchanged

When executing git checkout. Or the Git checkout-(file) command will replace all or specified files in the workspace with all staging area files or specified files. This action clears changes that have not been added to the staging area in the workspace

When executing git checkout HEAD. Or the Git checkout head (file) command replaces the files in the staging area and workspace with all or the specified files in the master branch that the head points to. Also clear uncommitted changes in workspace and temporary access

    

Full learning git two git staging area

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.