-
Notifications
You must be signed in to change notification settings - Fork 15
Creating a remote branch
abhikp edited this page Sep 15, 2011
·
3 revisions
If you want to collaborate with others or create a patched version of master you'll have to create a remote branch. Assuming we left off from Creating a local branch
```
% git status
# On branch abhiks-branch
# Changes to be committed:
# (use "git reset HEAD <file>..." to unstage)
#
# modified: README
#
# Changed but not updated:
# (use "git add <file>..." to update what will be committed)
# (use "git checkout -- <file>..." to discard changes in working directory)
#
# modified: a.java
#
```
-
Let's commit the staged and unstaged changes.
% git commit -am "Commiting more branch changes" [abhiks-branch 17d58c9] Commiting more branch changes 2 files changed, 2 insertions(+), 0 deletions(-) % git status # On branch abhiks-branch nothing to commit (working directory clean) -
Simply run
git push origin <branch name>(ignore the "", it's a formatting issue with the wiki).% git push origin abhiks-branch Counting objects: 11, done. Delta compression using up to 4 threads. Compressing objects: 100% (6/6), done. Writing objects: 100% (7/7), 815 bytes, done. Total 7 (delta 1), reused 0 (delta 0) To [email protected]:abhikp/git-test.git \* [new branch] abhiks-branch -> abhiks-branch -
Unfortunately, this doesn't set the local branch to track the remote branch (e.g. any changes pushed to the remote branch will not be detected by the local branch).
% git branch --set-upstream abhiks-branch origin/abhiks-branch Branch abhiks-branch set up to track remote branch abhiks-branch from origin.