Git command learning notes

Source: Internet
Author: User

Git command learning notes Git initialize git config command. The Git configuration file adopts the INI file format, git config is used to read and change the content of the INI configuration file git config [] name value git config [] -- unset name initialization name and email address git config -- system user. name "li song" git config -- system user. email sundayls@qq.com alias settings: git config -- system alias. delete ci commit: git config -- unset -- system alias. ci Command output enable color display git config -- global color. ui true -- global and -- system indicate the configuration location. -- Global indicates the configuration in the user's home directory, and -- system indicates the system level configuration file. If this parameter is not added, it indicates the version library level configuration file. The operation file. git/index in the temporary storage area is actually a directory tree containing the file index, which is a virtual workspace. The directory tree of this virtual workspace records the file name and file status information. The file content is stored in the Git object library. git/objects directory. Git add indicates to write the content of the specified file to a new object in the object library, update the directory tree, and record it to the file index in the temporary storage area. Git commit indicates to write the directory tree of the temporary storage area to the version library, and the master node is updated to point to the new directory tree (that is, the directory tree of the original storage area ). Git reset HEAD: replace the number of directories in the temporary storage area with the directory tree pointed to by the master. The work area is not affected. Git checkout Description: git checkout [] [--]... the directory tree to which commit points is used to replace the temporary storage area and workspace. If commit is omitted, it is equivalent to the example of checking out from the temporary storage area: git checkout -- <file> replace git checkout In the workspace with the file in the temporary storage area. replace the git checkout HEAD in the workspace with all the files in the staging area. <file> indicates replacing the staging area with the directory tree file pointed to by the master and git checkout In the workspace [<bracnch>] example: git checkout branch: The update HEAD points to the branch. Use the directory tree indicated by branch to update the temporary storage area and git checkout in the work area. git checkout-B <new_branch> <start_point> is equivalent to git branch <branchnam E> git checkout <branchname> creates and switches to a new branch, the new branch starts from the commit indicated by start_point to create git diff-workspace comparison staging zone git diff -- cached-staging zone Comparison HEAD git diff HEAD-workspace Comparison HEAD Git object git cat- run the file-p sha1 value to view the sha1 object content. The remote version library git checkout-B <new_branch> <remote-branch> creates a local branch from the remote branch, automatically creates a trail. Git remote add <remotename> <url> register the remote repository git remote-v to view the registered remote repository git push command. Explanation: 1. if <remote> is set for the current branch, it is equivalent to git push <remote> 2. <remote> is not set, which is equal to git push origin3. if you create a branch in the remote version library, execute git push <remote> <new_breanch>

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.