[Switch] git usage rules

Source: Internet
Author: User

Link: http://blog.csdn.net/zhangyaoming2004/article/details/9202269

 

 

Common git commands

Git clone address: copy the code library to a Local Machine

Git add file: add the file to the code library.

Git RM file: delete files in the code library

Git commit-M <message>: Submit the changes. After modifying the file, use this command to submit the changes.

Git pull: Synchronize code from remote to local

Git push: Push code to remote code library

Git branch: view the current local branch

Git branch-r view remote Branch

Git branch <branch-Name>: Creates a local branch.

Git branch-D <branch-Name>: deletes a local branch.

Git checkout <branch-Name>: switch to the local branch

Git push origin test: MASTER: Submit the local test branch as the remote master Branch (what if you want to delete the remote branch? Similarly, if the left branch is empty, the remote branch on the right will be deleted .)

Git log: view the commit record (History of the commit record)

Git status: the current modification status. Whether the modification has not been submitted, or which files are not used

Git reset <log>: returns to a previous version.

 

 

Git tag <Name>: Create version

Git Tag: View version
Git tag-D <Name>: delete version
Git tag-R: view the remote version

Development Process:
The GIT process is generally used:
1. edit the file and update the code.

2. Fill in the Code to the list of changes currently submitted: git add <modified File>

3. Submit the current modification as a record: git commit-M <message>

4. Update the code: git push

FAQs:

1. When to submit a change record (COMMIT)

Add a new feature or break the original structure, and even each change can be used as a basis for submitting change records

2. When to push updates)

In general, if you change the project structure (file, directory), you should push the update as soon as possible to notify other collaborators to follow up on the update.

3. When is remote synchronization (pull)

Synchronization should be performed every time you start to work.

4. When to open a branch)

Remote branch, by function

Local branch, random

[Switch] git usage rules

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.