The branch operation of GitHub learning experience

Source: Internet
Author: User

Directory

Objective
1. General Push and pull
2. Branching operations

Objective

This article summarizes the branch operations of GitHub, based on the following articles:

http://blog.csdn.net/guang11cheng/article/details/37757201 (Create a new branch on GitHub)
Http://www.cnblogs.com/mengdd/p/3447464.html (Managing projects on GitHub)
https://help.github.com/articles/merging-a-pull-request/(Merging a pullrequest)

one or one-like Push and the Pull

Push

git remote add originhttps://github.com/xxx (username)/yyyy (projectname). git
Git push-u Origin Master

Pull

Git pull Origin master//pulling from GitHub to the local source repository

In fact, the pull command is git fetch plus git merge

Git fetch origin
git merge Origin/master

Note:

git merge Brancha Branchb
Branchb generally assume that the current branch

That
git merge Origin/master
Merge the Master branch on origin into the current branch

Second, branch operation

To create a new branch locally:

Git branch Dev

Switch to your new branch:

git checkout Dev

Push Branch

Method 1 :

Git push Origin Dev

Method 2 :

Git push-u origin Local:remote

Like what:

Git push-u origin Master:master

Indicates that the local master branch (before the colon) is push to the master branch of GitHub (after the colon).

Note: If the left side is not empty, the remote right branch will be deleted.

Delete Branch

Git branch//can see all the branches
git branch-d dev//Remove DEVELOP2 Branch

Merging branches

The git merge Master//git Merge command is mentioned in the above (1. General Push and pull)

Remote Side Delete branch:

Git push origin:d Ev

Note: Push The branching method is explained in two

Remote Merge Branch

Merging a pull request (https://help.github.com/articles/merging-a-pull-request/) with page operation method

Command-line method (not feasible after experiment):

1. Use the git checkout command to switch branch to remote branch
2. Merging with git merge

Direct git merge merge, feasibility pending test

The branch operation of GitHub learning experience

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.