Git, github

Source: Internet
Author: User

Git, github

# Create a git Repository
Git init
# Add a file to the git Repository
Git add filename
# Submit the file to the git Repository
Git commit-m'description'
# View git status
Git status
# View the modified content of the file
Git diff filename
# Viewing submission history
Git log [-- pretty = oneline]
# Version rollback. HEAD: indicates the current version; HEAD ^: indicates the previous version.
Git reset -- hard version number (only the first few digits can be written)
# Every Command record
Git reflog
# View the differences between the latest version in the workspace and version Library
Git diff HEAD -- filename
# Discard the workspace changes (the file is returned to the status of the last git commit or git add operation)
Git checkout -- filename
# Undo the modification after git add and put it back to the Workspace
Git reset HEAD filename
# Deleting an object
Git rm filename
Git commit filename
# If the file is deleted incorrectly, you can easily restore the accidentally deleted file to the latest version because it is still available in the version library.
Git checkout -- filename

Related Article

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: 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.