Git basic usage

Source: Internet
Author: User

git distributed, collaborative development

git hub server

A. Advantages of using version control tools

A) The development process of the software can be seen

b) The operation can be restored by mistake

B. How to use git to manage source code

1. Create a git repository yum install git git version view version

2. tell git the name and the mailbox git config--global "yogurt" git config--global "[email protected] "

3. initializing the repository git init rename ( working directory )

4. Add Command adds file to repository git Add file name, can be used repeatedly, add multiple files

5. Commit file to the repository git commit-m " write it anywhere "

6. Status time to master the current state of the repository git statuses

On Branch Master No to commit means there is no need to raise price changes, working directory clean

7. diff View different points of the file

8. Log View change history git log

parameter --pretty=oneline

display format: commit ID ( version number ) notes

9. Git Reset--hard head^

head^ represents the current version, head^^ the first version


650) this.width=650; "src=" Http:// "title=" 14591829364304.jpg "alt=" Wkiom1cvhvqjfcwfaafw_edqw-q587.jpg "/>

10.reflog git reflog record every command

git reset--hard ID(first column) can go back to the future

11.checkout can discard modifications to the workspace

format git checkout-- file name

bring the file back to the nearest

This article is from "Doyle" blog, please make sure to keep this source

Git basic usage

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.