Common Git Commands

Source: Internet
Author: User

Add to Staging Area (stage)

git add <file>

To view the staging area status of a workspace

git status

Submit from staging area to latest version

git commint-m "comment"

Compare the differences between the latest version of the workspace and the repository:

git diff HEAD--readme.txt

View history, you can append parameters to each record line display:--pretty=oneline

git log

Fallback to previous version (plus one ^ for the last version)

git reset--hard head^

Back to a version according to Hashcode

git reset--hard 11801df

Undo the modification of the workspace (not the staging area), essentially replacing the workspace version with the version in the repository

Git checkout--readme.txt

Undo the Staging area changes (Unstage) and put them back in the work area.

git Reset HEAD readme.txt

Delete a file from the file system and repository

RM test.txtgit RM test.txtgit commit-m "Remove Test.txt"

Common Git Commands

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.