Common git commands

Source: Internet
Author: User

Note:
All development work should be performed in the local branch. Switch the main code of the branch synchronization before submission.
Requirement: After modifying a problem ticket, submit the ticket to your local computer and upload the code. Follow the code operation procedure described below.
[]: Indicates an optional parameter. It is best to include a parameter, which is used by warehouse.
Projectname; peojectname value contained in the remote tag in the. Git/config file in the GIT Library

Common git commands are as follows:
Main synchronization code: repo sync [projectname]
Create a local branch: git checkout-B branchname
Switch branch: git checkout branchname
Merge major branch updates to local development: git rebase remote branchname
Add and modify to cache: git add [-A] [filepath...]
Submit the modification to the local database: git commit
Submit the modification to the latest version: git commit -- Amend
Undo modification: git checkout filepath
Delete added: Use git RM filepath with caution. It is not recommended unless you have.
View submission records: git log [-- oneline]
Upload the local file to the master: repo upload [projectname]

Correct code operation process:
1. Get the latest code:
Git checkout remote
Repo sync
Git rebase remote branchname
If (conflict ){
Resolve Conflicts
Git add
Git rebase -- continue
}
2. Development:
Code Development
Git add
Git commit
3. Upload and submit:
Git checkout remote
Repo sync
Git rebase remote branchname
If (conflict ){
Resolve Conflicts
Git add
Git rebase -- continue
}
Git rebase branchname remote
Repo upload projectname

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.