Creating remote git branch

I started using an internal git repository here at work, then today I want to create a remote branch, then I find out this tips:

Creating a Remote Branch

1. Create the remote branch

git push origin origin:refs/heads/branch_name

2. Make sure everything is up-to-date

git fetch origin

3. Then you can see that the branch is created.

git branch -r

This should show ‘origin/new_feature_name’

4. Start tracking the new branch

git checkout --track -b new_feature_name origin/new_feature_name

This means that when you do pulls that it will get the latest from that branch as well.

5. Make sure everything is up-to-date

git pull

6. If you want to remove a remote branch then run:

git push origin :branch_name

Source: http://www.zorched.net/2008/04/14/start-a-new-branch-on-your-remote-git-repository/

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