Reading git authoritative guide

Source: Internet
Author: User
Tags diff

First, the Chinese file name can not be displayed correctly, but the real octal character encoding, how to solve?

$ git status

"\346\227\245\345\277\227.txt"

How to resolve:

git config--global core.quotepath false

$ git status

Log. txt

Ii.. What is a. git directory?

is a git repository (repository, repository), also known as a workspace.

Three, the difference between workspace, staging area, version library

Iv. Order

Config command

Display the workspace root directory: Git rev-parse--show-toplevel

Edit the Cofig file for your workspace: Git config–e

Edit the global config file: git config–e–global

Edit a value for config file: git config x.y.z others

Delete the value of the global config file: git config--unset–global user.name

Log command:

git log (show simple log)

git log--pretty=fuller (show full log)

git commit--amend--allow-empty--reset-author (Modify the last commit log and author information)

git log--stat (you can see the file change statistics for each commit in the log)

git log--pretty=oneline (view simple log information)

git log--graph--oneline (view shorter logs)

git log--pretty=raw--graph a2ee32 (log tracking)

Difference command

git diff (Compare Workspace vs. staging area differences)

git diff head (workspace and head comparison)

Git diff--cached (staging area and head comparison)

Status command

Git status–s (see short message)

Git status–s–b (view saved work progress data)

Undo Command

git checkout--xp.txt (undo workspace specified file content modification, new file cannot be undone)

Git checkout. (Undo the content modification of all files in the workspace),

git Reset--hard head^ (undo changes to this commit,-hard use caution, will damage the workspace changes)

git reflog Show Master | Head–5 (if hard undo regrets, you can view the revoked log through this command, if you need to open config: git config core.logallrefupdates)

git reset--hard [email protected]{2} (restore Hardreset undo)

git reset (Restore from staging area to workspace)

git reset Head (IBID.)

git reset head^ (Restore previous pointer to workspace)

Directory tree Browse for workspace, staging area, repository

Git ls-tree–l head (view current commit in repository) pointing to the directory tree

Git ls-files–s (view staging area) pointing to the directory tree

Submit command:

Git commit–m "Updage" (Commit staging area all modifications to repository)

Git commit–a (submit to Repository, including workspace content, this command is NOT recommended!!!) )

Save Work progress

Git stash (Save work area and staging area work progress)

git stash list (view shelved work progress)

Git stash pop (restores the latest saved work progress)

git stash drop (delete one work progress)

Git stash Clear (Clear all work progress)

Branch

Git branch (view branch)

git branch–v (View branch with pointer address)

git checkout [master] (toggle Branch)

git checkout–b [xxx] (new branch)

(TAG) tag

Git tag–m "v1" v1 (add tag)

ls. git/refs/tags (See all tags)

deleting files

RM *.txt (delete file, but only in workspace)

git rm *.txt (delete files and commit changes to staging area)

Moving files

git mv log. txt log.txt (renaming the log. txt to Log.txt)

Ignore file

Touch. Gitignore (Add ignore file, shared)

Reading git authoritative guide

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.