Git to create a branch

Source: Internet
Author: User
Tags git clone
git to create a branch first get a clean copy of the code, such as
$ git clone <...>
View the current code's branching status
$ git Branch
* Master

Where the * number indicates the branch you are currently using to create a branch

$ git Branch release_1.0

In the command above

$ git Branch
* Master
  release_1.0
commit This branch to a remote repository
$ GIT push origin release_1.0 total
  0 (Delta 0), reused 0 (Delta 0) to
  ...
   * [New branch]      release_1.0-> release_1.0
Toggle Branch
$ git checkout release_1.0

Then look at the branching situation, at which point the current work branch becomes release_1.0.

$ git Branch
  Master
* release_1.0

If you want to switch back, you can run the following command

$ git checkout master
$ git Branch
* Master
  release_1.0
submitting code to a branch

If you are submitting code to a branch, you first need to switch the current work environment to the branch where you want to submit the code, and then use the steps that normally we submit code to submit the code as follows: submit code to master

git checkout master
git add readme.md
git commit-m ' test commit to Master ' readme.md
git push
submitting code to the release_1.0 branch
git checkout release_1.0
git add readme.md
git commit-m ' test commit to release_1.0 branch ' readme.md
git p Ush

Reprint please indicate this link form link
This article link: http://blog.csdn.net/kongxx/article/details/51828837

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.