Git branch operation tutorial, git branch operation tutorial

Source: Internet
Author: User

Git branch operation tutorial, git branch operation tutorial

1. Create a branch

Git branch name

2. Switch Branch

Git checkout branch name

3. Submit the code after modifying the branch

Git add -- all // submit all the modified Code

Git commit-m "1" // submit and add remarks

4. Switch to master

Git checkout master

5. merge branches

Git pull origin master // pull the code again first

Modify the branch name of git merge to merge

6. If an error is found, roll back to the original version.

Git reset -- hard // roll back to the previous version. If you need to push to the specified version, run git log to query the version number first.

Git reset -- hard version number

7. After the merging is correct

Git add -- all

Git commit-m "Remarks"

8. upload to the server

Git push origin master

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.