updated all the book urls
This commit is contained in:
@@ -5,15 +5,15 @@ layout: reference
|
||||
<div class="box">
|
||||
<h2>
|
||||
<span class="docs">
|
||||
<a target="new" href="http://progit.org/book">book</a>
|
||||
<a target="new" href="http://progit.org/book/ch2-5.html">book</a>
|
||||
</span>
|
||||
Sharing and Updating Projects
|
||||
</h2>
|
||||
<div class="block">
|
||||
<p>
|
||||
Git doesn't have a central server like Subversion. All of the commands
|
||||
so far have been done locally, just updating a local database.
|
||||
To collaborate with other developers in Git, you have to put all that
|
||||
so far have been done locally, just updating a local database.
|
||||
To collaborate with other developers in Git, you have to put all that
|
||||
data on a server that the other developers have access to. The way Git
|
||||
does this is to syncronize your data with another repository. There
|
||||
is no real difference between a server and a client - a Git repository
|
||||
@@ -27,14 +27,14 @@ layout: reference
|
||||
</p>
|
||||
|
||||
<p>You can do this any time you are online, it does not have to correspond
|
||||
with a <code>commit</code> or anything else. Generally you will do a
|
||||
with a <code>commit</code> or anything else. Generally you will do a
|
||||
number of commits locally, then fetch data from the online shared repository
|
||||
you cloned the project from to get up to date, merge any new work into the
|
||||
stuff you did, then push your changes back up.</p>
|
||||
|
||||
<p class="nutshell">
|
||||
<b>In a nutshell</b> you can update your project with <code>git fetch</code>
|
||||
and share your changes with <code>git push</code>. You can manage your
|
||||
and share your changes with <code>git push</code>. You can manage your
|
||||
remote repositories with <code>git remote</code>.
|
||||
</p>
|
||||
</div>
|
||||
@@ -44,7 +44,7 @@ layout: reference
|
||||
<h2>
|
||||
<span class="docs">
|
||||
<a target="new" href="http://www.kernel.org/pub/software/scm/git/docs/git-remote.html">docs</a>
|
||||
<a target="new" href="http://progit.org/book/">book</a>
|
||||
<a target="new" href="http://progit.org/book/ch2-5.html#showing_your_remotes">book</a>
|
||||
</span>
|
||||
<a name="push">git remote</a>
|
||||
<span class="desc">list, add and delete remote repository aliases</span>
|
||||
@@ -59,8 +59,8 @@ layout: reference
|
||||
and others that you can write to as well.</p>
|
||||
|
||||
<p>So that you don't have to use the full URL of a remote repository every
|
||||
time you want to syncronize with it, Git stores an alias or nickname for
|
||||
each remote repository URL you are interested in. You use the
|
||||
time you want to syncronize with it, Git stores an alias or nickname for
|
||||
each remote repository URL you are interested in. You use the
|
||||
<code>git remote</code> command to manage this list of remote repos that
|
||||
you care about.</p>
|
||||
|
||||
@@ -70,10 +70,10 @@ layout: reference
|
||||
</h4>
|
||||
|
||||
<p>Without any arguments, Git will simply show you the remote repository
|
||||
aliases that it has stored. By default, if you cloned the project (as
|
||||
aliases that it has stored. By default, if you cloned the project (as
|
||||
opposed to creating a new one locally), Git will automatically add the
|
||||
URL of the repository that you cloned from under the name 'origin'. If
|
||||
you run the command with the <code>-v</code> option, you can see the
|
||||
you run the command with the <code>-v</code> option, you can see the
|
||||
actual URL for each alias.</p>
|
||||
|
||||
<pre>
|
||||
@@ -94,12 +94,12 @@ origin git@github.com:schacon/git-reference.git (push)
|
||||
</h4>
|
||||
|
||||
<p>If you want to share a locally created repository, or you want to take
|
||||
contributions from someone elses repository - if you want to interact in
|
||||
contributions from someone elses repository - if you want to interact in
|
||||
any way with a new repository, it's generally easiest to add it as a remote.
|
||||
You do that by running <code>git remote add [alias] [url]</code>. That
|
||||
adds <code>[url]</code> under a local remote named <code>[alias]</code>.</p>
|
||||
|
||||
<p>For example, if we want to share our Hello World program with the world,
|
||||
<p>For example, if we want to share our Hello World program with the world,
|
||||
we can create a new repository on a server (I'll use GitHub as an example),
|
||||
which should give you a URL, in this case "git@github.com:schacon/hw.git".
|
||||
To add that to our project so we can push to it and fetch updates from it
|
||||
@@ -114,9 +114,9 @@ github git@github.com:schacon/hw.git (push)
|
||||
</pre>
|
||||
|
||||
<p>Like the branch naming, remote alias names are arbitrary - just as 'master'
|
||||
has no special meaning but is widely used because <code>git init</code>
|
||||
sets it up by default, 'origin' is often used as a remote name because
|
||||
<code>git clone</code> sets it up by default as the cloned-from URL. In
|
||||
has no special meaning but is widely used because <code>git init</code>
|
||||
sets it up by default, 'origin' is often used as a remote name because
|
||||
<code>git clone</code> sets it up by default as the cloned-from URL. In
|
||||
this case I've decided to name my remote 'github', but I could have really
|
||||
named it just about anything.
|
||||
</p>
|
||||
@@ -147,9 +147,9 @@ github git@github.com:schacon/hw.git (push)
|
||||
</pre>
|
||||
|
||||
<p class="nutshell">
|
||||
<b>In a nutshell</b> with <code>git remote</code> you can list our
|
||||
<b>In a nutshell</b> with <code>git remote</code> you can list our
|
||||
remote repositories and whatever URL
|
||||
that repository is using. You can use <code>git remote add</code> to
|
||||
that repository is using. You can use <code>git remote add</code> to
|
||||
add new remotes and <code>git remote rm</code> to delete existing ones.
|
||||
</p>
|
||||
|
||||
@@ -160,7 +160,7 @@ github git@github.com:schacon/hw.git (push)
|
||||
<h2>
|
||||
<span class="docs">
|
||||
<a target="new" href="http://www.kernel.org/pub/software/scm/git/docs/git-fetch.html">docs</a>
|
||||
<a target="new" href="http://progit.org/book/">book</a>
|
||||
<a target="new" href="http://progit.org/book/ch2-5.html#fetching_and_pulling_from_your_remotes">book</a>
|
||||
</span>
|
||||
<a name="fetch">git fetch</a>
|
||||
<span class="desc">download new branches and data from a remote repository</span>
|
||||
@@ -181,9 +181,9 @@ github git@github.com:schacon/hw.git (push)
|
||||
|
||||
<p>Git has two commands to update itself from a remote repository.
|
||||
<code>git fetch</code> will syncronize you with another repo, pulling down any data
|
||||
that you do not have locally and giving you bookmarks to where each branch on
|
||||
that you do not have locally and giving you bookmarks to where each branch on
|
||||
that remote was when you syncronized. These are called "remote branches" and are
|
||||
identical to local branches except that Git will not allow you to check them out -
|
||||
identical to local branches except that Git will not allow you to check them out -
|
||||
however, you can merge from them, diff them to other branches, run history logs on
|
||||
them, etc. You do all of that stuff locally after you syncronize.
|
||||
</p>
|
||||
@@ -201,7 +201,7 @@ github git@github.com:schacon/hw.git (push)
|
||||
<p>Assuming you have a remote all set up and you want to pull in updates, you
|
||||
would first run <code>git fetch [alias]</code> to tell Git to fetch down all the
|
||||
data it has that you do not, then you would run <code>git merge [alias]/[branch]</code>
|
||||
to merge into your current branch anything new you see on the server
|
||||
to merge into your current branch anything new you see on the server
|
||||
(like if someone else has pushed in the meantime). So, if I were working on my
|
||||
Hello World project with several other people and I wanted to bring in any changes
|
||||
that had been pushed since I last connected, I would do something like this:</p>
|
||||
@@ -216,7 +216,7 @@ Resolving deltas: 100% (1526/1526), completed with 387 local objects.
|
||||
From github.com:schacon/hw
|
||||
8e29b09..c7c5a10 master -> github/master
|
||||
0709fdc..d4ccf73 c-langs -> github/c-langs
|
||||
6684f82..ae06d2b java -> github/java
|
||||
6684f82..ae06d2b java -> github/java
|
||||
* [new branch] ada -> github/ada
|
||||
* [new branch] lisp -> github/lisp
|
||||
</pre>
|
||||
@@ -228,11 +228,11 @@ From github.com:schacon/hw
|
||||
into 'master'.
|
||||
</p>
|
||||
|
||||
<p>You can see the mapping that Git makes. The 'master' branch on the remote
|
||||
<p>You can see the mapping that Git makes. The 'master' branch on the remote
|
||||
repository becomes a branch named 'github/master' locally. That way now I can
|
||||
merge the 'master' branch on that remote into my local 'master' branch by running
|
||||
<code>git merge github/master</code>. Or, I can see what new commits are on that
|
||||
branch by running <code>git log github/master ^master</code>. If your remote
|
||||
branch by running <code>git log github/master ^master</code>. If your remote
|
||||
is named 'origin' it would be <code>origin/master</code> instead. Almost any
|
||||
command you would run using local branches you can use remote branches with too.
|
||||
</p>
|
||||
@@ -242,8 +242,8 @@ From github.com:schacon/hw
|
||||
with all of your remotes by running <code>git fetch --all</code>.
|
||||
|
||||
<p class="nutshell">
|
||||
<b>In a nutshell</b> you run <code>git fetch [alias]</code> to syncronize your
|
||||
repository with a remote repository, fetching all the data it has that you do
|
||||
<b>In a nutshell</b> you run <code>git fetch [alias]</code> to syncronize your
|
||||
repository with a remote repository, fetching all the data it has that you do
|
||||
not into branch references locally for merging and whatnot.
|
||||
</p>
|
||||
|
||||
@@ -255,7 +255,7 @@ From github.com:schacon/hw
|
||||
<h2>
|
||||
<span class="docs">
|
||||
<a target="new" href="http://www.kernel.org/pub/software/scm/git/docs/git-push.html">docs</a>
|
||||
<a target="new" href="http://progit.org/book/">book</a>
|
||||
<a target="new" href="http://progit.org/book/ch2-5.html#pushing_to_your_remotes">book</a>
|
||||
</span>
|
||||
<a name="push">git push</a>
|
||||
<span class="desc">push your new branches and data to a remote repository</span>
|
||||
@@ -263,7 +263,7 @@ From github.com:schacon/hw
|
||||
|
||||
<div class="block">
|
||||
<p>To share the cool commits you've done with others, you need to push your
|
||||
changes to the remote repository. To do this, you run
|
||||
changes to the remote repository. To do this, you run
|
||||
<code>git push [alias] [branch]</code> which will attempt to make your [branch]
|
||||
the new [branch] on the [alias] remote. Let's try it by initially pushing
|
||||
our 'master' branch to the new 'github' remote we created earlier.</p>
|
||||
@@ -304,15 +304,15 @@ To git@github.com:schacon/hw.git
|
||||
|
||||
<p>The last major issue you run into with pushing to remote branches is the
|
||||
case of someone pushing in the meantime. If you and another developer clone
|
||||
at the same time, you both do commits, then she pushes and then you try to
|
||||
at the same time, you both do commits, then she pushes and then you try to
|
||||
push, Git will by default not allow you to overwrite her changes. Instead,
|
||||
it basically runs <code>git log</code> on the branch you're trying to push and
|
||||
makes sure it can see the current tip of the servers branch in your pushes
|
||||
history. If it can't see what is on the server in your history, it concludes
|
||||
that you are out of date and will reject your push. You will rightly have to
|
||||
fetch, merge then push again - which makes sure you take her changes into
|
||||
fetch, merge then push again - which makes sure you take her changes into
|
||||
account.</p>
|
||||
|
||||
|
||||
<p>This is what happens when you try to push a branch to a remote branch
|
||||
that has been updated in the meantime:</p>
|
||||
|
||||
|
Reference in New Issue
Block a user