Git Learning Notes

Source: Internet
Author: User

git rev-parse --git-dir  displays the repository. Git directory is in the same location git rev-parse --show-toplevel   Show Workspace root git log -1 --pretty=raw git cat-file -t id   See what the ID corresponds to git  cat-file -t ID   View the storage record for the ID git log --graph --oneline   can display a shorter commit idgit reset --hard +id or head etc   Reset cursor can be saved with Reflog reset git reflog show  Master |head -5  gitreflog Command, operation of the file, using the show subcommand to display the contents of this file, and directly view the file Tail-5.git/log/refs/heads The difference between the/master is that the display order is different, that is, the most recent change is displayed on the front git reset --hard [email protected]{2}git reset  Resets the hold zone only with the directory tree that the head points to, the workspace is unaffected, and the content that was previously updated with the Gitadd command to the deferred zone is withdrawn, and the reference is not changed because the reference reset to head is equivalent to no reset, equivalent to Gitreset headgit  reset -- filename only want to file filename changes to withdraw staging area, staging area other files do not change, the equivalent of git addfilename anti-operation, =git reset The  head filenamegit reset --soft head^ workspace and staging area do not change, but the reference is rolled back once, when the submission instructions or the submitted changes are not satisfied with the latest submission, Revoking the latest submissions for resubmit git stash  can be used to protectSave and restore work Progress git stash  Save current work progress, save staging area and workspace status separately git stash list  show progress list Git stash  pop [--index] [<stash>] If you do not use any parameters, the latest saved work progress is restored and the work progress of the recovery is purged from the stored work progress list. Option--index In addition to recovering files from the workspace, try to recover staging area git stash drop [<stash>]  The progress of deleting a store, by default deleting recent progress git  stash clear   Delete all the storage progress git stash branch <branchname> <stash>   Create a branching git repository based on progress the Ignore file feature: Ignore files that are only valid for the non-tracked file, and are not valid for files that have been added to the repository. Ignore Category: Shared ignore: file. The file ignored by Gitignore is shared, and is called shared because the. Gitignore is added to the repository as part of the repository, when the repository is shared with others (clones), or when the repository is pushed to a centralized server, the ignore file appears in his In a person's workspace, the file is ignored in the other person's workspace as effective. Exclusive ignore: Not because the version of the library or the push between the repository to pass to others file ignored, the exclusive ignore divided into two kinds: 1, the specific version of the repository of independent ignore, that is, in the repository. Git directory of a file. Git/info/exclude to set ignore file 2, Another global standalone ignore, that is, the GIT configuration variable core.excludesfile a specified ignore file. The Ignore setting is valid for all repositories Eg: git config --global core.excludesfile /home/cp/.gitignore ignore syntax: 1, If the first path delimiter (/) of the name indicates the file to be ignored in this directory, not the subdirectory of file 2, if the name is the most followed by a path delimiter (/), indicating that the entire directory is to be ignored, files with the same name are not ignored, otherwise files and directories with the same name are ignored by 3, By adding an exclamation point to the last face of the name (! ), which means not ignoring GIt commit --amend  fix commit git clone usage 1:git clone <repository> <directory>: <repository> point to the repository to create a clone to <directory> directory, which is equivalent to the workspace of the clone repository, the file is checked out, and the repository is in the. git directory under the workspace 2:git clone  --bare <repository> <directory> usage 3:git clone --mirror < Repository> <directory> usage 2 and Usage 3 Create a clone repository that does not contain a workspace, which is directly the content of the repository, which is known as the bare repository. The directory names of the generally accepted versions of the bare repository are suffixed with. Git; usage 3 is different from usage 2 expense is in usage 3 cloned version of the upstream repository is registered so that you can use the Git fetch command in the bare repository and the upstream repository for continuous synchronization. Git pull [<remote-repos>] [<refspec>]git push [<remote-repos>]  [<refspec>] Peer repository: Not applicable--bare or--mirror the clone that was created contains the workspace. This repository has only one workable mode of operation, that is, the backup library executes the Git pull command to pull back the new commit from the source library to implement the repository synchronization. git init --bare  can also generate temporary objects introduced by the bare repository    staging area operation, and you can use the GIT&NBSP;FSCK command to view the loose objects contained in the repository that are not associated with any references , you can remove files from the repository completely with the git prune  command (the temporary objects introduced when the staging area operation is cleared, but if you discard the commits and files with the Reset command, they will not be easily erased) Git reflog expire  --expire=now --all--expire=<data>  Ginseng, forcing the <data> record to expire before executing the git prunegit ls-remote  command to display references to remote repositories the corresponding SHA1 hashes prohibit non-fast push: 1, change server repository/ Configuration variables for Path/to/repos/shared.git git --git-dir=/path/to/repos/shared.git config  receive.denynonfastforwardstruegit tag  Display Milestone git tag -n<num> display a description at the time of the milestone, using <num > Description of how many line milestones are displayed git tag  -l jx/v2*   using wildcard characters to filter the display git log --oneline -- decorate  can find the submission corresponding to the milestone and its reference git describe  displays the submission as an easy-to-remember name-building milestone: Usage 1:git tag <tagname>[ <commit>] usage 2:git tag -a <tagname>[<commit>] Usage 3:git tag -m<msg > <tagname>[<commit>] usage 4:git tag -s <tagname>[<commit>] Usage 5:git  tag -u <key-id> <tagname>[<commit>] Method 1 is the creation of lightweight milestones, methods 2, 3 are created with a description of the milestone, Method Three provides a description of the creation milestone directly through the-m parameter, and Method 4, 5 creates a milestone with GNUPG signature

This article is from the "Vbird" blog, make sure to keep this source http://cpvbird.blog.51cto.com/3165113/1619363

Git Learning Notes

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.