Information Technology Reference
In-Depth Information
$ cd git-recipes
$ mkdir 10-06
$ cd 10-06
$ git init --bare shared-repo
Next create a repository for John, create an initial revision , and send it to the
shared-repo
:
$ git clone shared-repo johns-repo
$ cd johns-repo
$ git simple-commit "Initial commit"
$ git push -u origin master
Then create a repository for Sarah:
$ git clone shared-repo sarahs-repo
Let's assume that John is the leader. He is responsible for setting tasks for all team
members. He decides that some of the team's members (including Sarah) will work on
documentation. The work will be done in a branch named
doc
. For this purpose, John
creates in his repository a new ordinary local branch named
doc :
# john's command
$ git branch doc
Then John makes the branch available for other developers. He pushes his doc
branch into
shared-repo
with:
# john's command
$ git push -u origin doc
The
-u
the above command sets the tracking in
johns-repo
for the
doc
branch.
After the above command,
shared-repo
contains the
doc
branch. You can verify it
running:
# shared-repo's command
$ git branch