Linux git basic usage summary <4>

Source: Internet
Author: User

1. Setting aliases

Cases:

git config--global alias.st status use St instead of status

Later view state git status-> git St can

You can also include parameters

Cases:

git config--global alias.ci "commit-m"

Git commit-m "Balabala", Git ci "balabala" after commit

git config has several parameters that can be used by global or system to make it available to all users

2. Turn on color display

git config--global color.ui true

3.git diff

git diff comparison Workspace vs. staging area files (no difference after git add xx)

Comparison of Git diff head workspace and last commit version (head)

git diff--cached Staging area and head comparison

4.git Checkout

<1>git Checkout Branch switch to branch branch

<2>git Checkout summary showing differences in workspaces, staging area, head

<3>git Checkout HEAD Ibid.

<4>git Checkout--filename to overwrite the filename file of the workspace with the staging area filename file

<5>git Checkout Branch--filename maintain point head, replace the branch and the corresponding file in the workspace with the filename in the submission that staging area points to

<6>git Checkout--. or writing git checkout. (There's a point on the left)

This command is the most dangerous and will cancel all local modifications, relative to the staging area.

Equivalent to overwriting local files with all files of staging area, without giving the user any chance of confirmation

5. File Ignore

Create a file named. Gitignore in the directory (with a dot in front of it) and write the file you want to ignore in one row for each file you want to ignore.

You can add. Gitignore to the repository, or you can ignore yourself (. gitignore files) in ignore

You can see the ignored files with git status--ignored-s

Ignores files that are not tracked and is not valid for files that have been added to the repository.

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.