Create a branch in github


We always used to create a branch on local system and after verify and ok with code, we merged to master branch. Today i was facing situation, i need to create a branch on remote git repository. Actually my manager wanted to take look to my code before merge to master branch(As he is residing out of country).

1.First create the branch locally:

git branch rspec-test-import

2.List all local branch.

git branch
*master
rspec-test-import

3.Checkout to local branch.
git checkout rspec-test-import

4.Again list branch and see where we are?
git branch
master
*rspec-test-import

5.Now create the remote branch and push your code.
git push --all
OR
git push origin rspec-test-import

That's it. Now you able to pull and push your changes to branch repository too. 
Cheers..!!!!!
Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s