Use a reader
Subscribe by Email
Blog » Remote Git Branch
Posted on 22 Sep 2010 13:03
The remote branch is automaticly created when you push it to the remote server. So when you feel for it, you can just do
git push <server-name> <branch-name>
Your colleagues would then just pull that branch, and it's automaticly created local.
Note however that formaly, the format is:
git push <server-name> <local-branch-name>:<remote-branch-name>
But when you ommit one, it assumes both names are the same.
Now you can start tracking the remote branch locally:
git branch --track <branch> <remote-branch>
This creates a tracking branch. Will push/pull changes to/from another repository.
git branch --track experimental origin/experimental
In addition to branches, you would like to create tags. Branches proceed, tags stay in place. Tags are useful to label deployments.
$ git tag -a v1.2 -m 'version 1.2' $ git tag v0.1 v1.0 v1.2 $ git push --tags
Who are you?
Git commits and tags require who you are. You can define yourself simply issuing those before anything:
git config --global user.name "Your Name" git config --global user.email "firstname.lastname@example.org"
The —global option means that this command will set global information, (affecting all repositories on this machine), in the .gitconfig file in your home directory. Alternately, you could omit the —global which would make the change take effect only in the local repository. This is convenient if you want to have different email addresses associated with different projects, for example.
If you like this page, please spread the word:
You can contact me if you have questions or corrections.