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