Git User Guide

Source: Internet
Author: User
Linus is a version control project initiated by Linux kernel project.
Head indicates the latest status. A tag is a status tag. Sha1 is the unique identifier of each submitted log. install: apt-get install git-core
git clone: Git repository can be obtained by using git clone:
git clone git: //url
You can also browse through a browser. http: //url/gitweb/
Use git pull to update the repository and use git init-dB to initialize your repository.
config: Developers need to configure relevant information for the GIT repository so that the information will automatically
It is reflected in the logs of the GIT repository. git config user.name
"your name" git config user.email yourname@email_server
git config core.editor vim
git config core.paper
"less -N" git config color.diff
true git config alias.co checkout
Git config alias. You can use git Co to represent git checkout. Git var-l can be viewed
The configured configuration. diff: After local development, developers can use git diff to view the changes.
In addition to comparing the changes made after development, git diff can also:
Git diff tag compares the differences between the tag and the head.
Git diff Tag file compares the differences between two files.
Git diff tag1.. tag2 compares the differences between two tags.
Git diff sha11.. sha12 compares the differences between two commits.
git diff tag1 tag2 file or
Git diff tag1: file tag2: file compares the differences between two tags of a file.
Orig_head is used to indicate the previous operation status. Therefore, if you want to obtain
Content: git diff ORIG_HEAD
Git diff -- stat is used to generate statistics.
git diff --stat ORIG_HEAD
apply: Git apply is equivalent to the patch command.
-- Check whether the patch can be installed normally. In-V verbose mode, in-r reverse mode, the patch is reversed.
log :
git log
File to view the changes to a file. git log
-P: View logs and changes. git log
Tag1.. tag2 view the logs between two tags. git log
-P tag1.. tag2 file: view the differences between two tags in a file. git log
Tag... view the differences between tag and head. commit: Git commit-a-e submits all modification files and calls Vim to edit and submit logs.
git reset HEAD^ or
Git reset head ~ 1. Cancel the last submission.
Git reset -- hard head ^ undo the last commit and clear local modifications.
Git reset sha1 returns to the submission status corresponding to sha1.
add/ delete /ls:
Git add-a to add all files. Except for files in the. gitignore file.
Git RM file: delete a file from the GIT repository.
After git commit is added or deleted, it must be submitted.
Git LS-files-M Displays the modified files.
Git LS-files displays all files in the repository.
Git has four types of objects: blob, tree, commit, and tag.
Blob indicates a file, tree indicates a directory, commit indicates a submission history, and tag indicates a tag.
All four objects are represented by the sha1 value. The GIT management repository is saved in the. Git directory of the repository.
All required information. Git LS-tree head file displays the sha1 value of the file in the head.
Git cat-file-T sha1 displays a type of sha1.
Git cat-file type sha1 displays the content of a sha1. Type is one of blob, tree, commit, and tag.
patch: Git format-patch-1 generates the patch file corresponding to the last commit.
Git am <patch adds a patch file to the GIT repository.
Git am -- resolved if there is a conflict, execute it after resolving the conflict.
Git am -- Skip discard the patch introduced by git AM.
conflict: Git merge is used to merge two branches.
If there is a git diff conflict, use diff to view it directly,
The conflicting code is represented by <and >>>. Manually modify the conflict code.
Git Update-index updates the modified File status.
Git commit-a-e submits the code modified to resolve the conflict.
branch: Git branch-a to view all branches.
Git branch new_branch creates a new branch.
Git branch-D branch: delete a branch.
Git checkout Branch switches the current branch. The-F parameter can overwrite unsubmitted content.
daemon: Sometimes the update public code repository uses the patch method, or directly
Use git pull git: //ip/repo branch
To update everyone's code. To use git pull, you must
Run the machine that submitted the Code: git daemon --verbose --export-all --enable=receive-pack --base-path=/repo
request-pull: Git request-pull start URL is used to generate statistics for this pull request.
clean: Git clean-DXF is used to clear untracked files.
Git clean-DNF can display the files to be deleted, but not those ignored by. gitignore.
Git reset -- hard head is used to clear modifications to trace files.

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.