GitHub usage record (continuous update)

Source: Internet
Author: User

Workspace, repository resolution

Reference Link: http://blog.csdn.net/felix_f/article/details/8777463

The left side is the workspace, which is the directory we normally see, the gallery on the right, where the index on the left side of the repository is staging area (stage, index) and the right side is a branch (master in the figure)

    • We modify the files in the workspace, and the add can be modified to staging area;
    • When you modify a file in the workspace without add, you can replace the files in the workspace with the files in the staging area by checkout--<file>
    • And when we and add, we can submit the files in the master branch to the staging area by reset head
    • The add content can be added to the master branch via commit
    • To delete a file in staging area by using RM--cached
    • Checkout HEAD <file> replaces files in staging area and workspaces with all or part of the files in the master branch

Command

git clone clone a project to local

    • git clone

git Status View the current state of the GIT project

You can see that git status can be displayed in three different situations:

    • The commit but no push (the master branch in the repository and the engineering difference on the Web) is in:Your branch is ahead of the ' Origin/master ' by 1 commit.
    • Already add but no commit (the master branch in the repository and the staging area of the version), which is the green part of the
    • Modified in the workspace but without add (the difference between workspaces and staging area), the red part in

git add <path> commit changes in workspace to staging area

    • -U adds information to the index library of the modified or deleted files in all the tracked files in <path>. It does not process untracted files.
    • -A [<path>] means to add file information from all tracked files in <path> to the index library that have been modified or deleted and all untracted.

git checkout to replace files in staging area with your workspace

    • git checkout branch check out the branch branch. To complete the three steps in the diagram, update the head to point to the branch branch and update the staging area and workspace with the tree pointed to by branch.
    • git checkout/git Checkout head Summary shows the difference between the workspace, staging area, and head.
    • git checkout--filename overwrites the filename file in the workspace with the filename file in staging area. Equivalent to canceling local modifications since the last time git add filename was executed (if executed).
    • Git checkout branch--filename maintains head's direction unchanged. Replace the corresponding file in the staging area and workspace with the filename that branch points to in the submission. Note the filename files in the staging area and workspace are overwritten directly.
    • Git checkout--. or writing git checkout. Note the arguments for the git checkout command are a point ("."). )。 This command is the most dangerous! All local modifications (as opposed to staging area) are canceled. Equivalent to overwriting local files directly with all files of staging area

git commit commits the content in staging area to the branch

    • Git commit-m the "messages" argument followed by a string that tells Git the instructions for this modification. Always indicate the information at the time of each submission.

git push to push content from the repository to the remote branch

git pull moves the remote branch to the local

Gitignore syntax

Start with a slash "/" to indicate the directory;

Use the asterisk "*" to pass multiple characters;

With a question mark "?" Pass a single character

The square brackets "[]" contain a list of matches for a single character;

With an exclamation mark "!" Indicates that the matching file or directory is not ignored (tracked);

Annotate with #

Example

Keep all. v files in the project, ignoring all other files

**/* indicates that all files in the project are ignored

! **/*.V means tracking all *.V files in the project

where * * indicates directory recursion

#save all Verilog file (*.v)    **/*    !**/*.v

GitHub usage record (continuous update)

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.