From: Jonathan Nieder <jrnieder@gmail.com>
To: Geoff Russell <geoffrey.russell@gmail.com>
Cc: git@vger.kernel.org, Thomas Rast <trast@student.ethz.ch>,
Michael J Gruber <git@drmicha.warpmail.net>
Subject: git pull (Re: need advice on usage patterns)
Date: Sun, 25 Jul 2010 22:36:34 -0500 [thread overview]
Message-ID: <20100726033634.GA30877@burratino> (raw)
In-Reply-To: <AANLkTi=g2YNQtiH7+xzqWeoOV6p5r+Nwtt2kkCd3u6JN@mail.gmail.com>
Hi Geoff,
Geoff Russell wrote:
> There are notes on the "git pull" man page about not working on a remote branch
> but having a local branch with a different name and merging the remote branch.
> Why is this necessary?
The "git pull" man page is very unclear, I agree. Especially when
starting out, I would recommend looking at the User’s Manual (and the
other resources the git(1) man page recommends).
In this case, the section to look at would be Chapter 4, on Sharing
development with others[1].
Thanks for noticing.
Jonathan
[1] http://www.kernel.org/pub/software/scm/git/docs/user-manual.html#sharing-development
-- 8< --
Subject: pull documentation: Flesh out description
The current description in the pull man page does not say much more
than that “git pull” is fetch + merge. Though that is all a person
needs to know in the end, it would be useful to summarize a bit about
what those commands do for new readers.
Most of this description is taken from the “git merge” docs.
Cc: Thomas Rast <trast@student.ethz.ch>
Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
---
Documentation/git-pull.txt | 61 +++++++++++++++++++++++++++++++++++--------
1 files changed, 49 insertions(+), 12 deletions(-)
diff --git a/Documentation/git-pull.txt b/Documentation/git-pull.txt
index ab4de10..8803680 100644
--- a/Documentation/git-pull.txt
+++ b/Documentation/git-pull.txt
@@ -8,29 +8,66 @@ git-pull - Fetch from and merge with another repository or a local branch
SYNOPSIS
--------
-'git pull' <options> <repository> <refspec>...
+'git pull' <options> <repository> <branch>...
DESCRIPTION
-----------
-Runs 'git fetch' with the given parameters, and calls 'git merge'
-to merge the retrieved head(s) into the current branch.
-With `--rebase`, calls 'git rebase' instead of 'git merge'.
-Note that you can use `.` (current directory) as the
-<repository> to pull from the local repository -- this is useful
-when merging local branches into the current branch.
+Incorporates changes from a remote repository into the current
+branch. In its default mode, a `git pull` is shorthand for
+`git fetch` followed by `git merge FETCH_HEAD`.
-Also note that options meant for 'git pull' itself and underlying
-'git merge' must be given before the options meant for 'git fetch'.
+More precisely, 'git pull' runs 'git fetch' with the given
+parameters and calls 'git merge' to merge the retrieved branch
+heads into the current branch.
+With `--rebase`, it runs 'git rebase' instead of 'git merge'.
-*Warning*: Running 'git pull' (actually, the underlying 'git merge')
-with uncommitted changes is discouraged: while possible, it leaves you
-in a state that is hard to back out of in the case of a conflict.
+<repository> should be the name of a remote repository as
+passed to linkgit:git-fetch[1]. <branch> can be an
+arbitrary refspec (for example, the name of a tag), but
+usually it is the name of a branch in the remote repository.
+
+Default values for <repository> and <branch> are read from the
+"remote" and "merge" configuration for the current branch
+as set by linkgit:git-branch[1] `--track`.
+
+Assume the following history exists and the current branch is
+"`master`":
+
+------------
+ A---B---C master on origin
+ /
+ D---E---F---G master
+------------
+
+Then "`git pull`" will fetch and replay the changes from the remote
+`master` branch since it diverged from the local `master` (i.e., `E`)
+until its current commit (`C`) on top of `master` and record the
+result in a new commit along with the names of the two parent commits
+and a log message from the user describing the changes.
+
+------------
+ A---B---C remotes/origin/master
+ / \
+ D---E---F---G---H master
+------------
+
+See linkgit:git-merge[1] for details, including how conflicts
+are presented and handled. To cancel a conflicting merge,
+use `git reset --merge`.
+
+If any of the remote changes overlap with local uncommitted changes,
+the merge will be automatically cancelled and the work tree untouched.
+It is generally best to get any local changes in working order before
+pulling or stash them away with linkgit:git-stash[1].
OPTIONS
-------
+Options meant for 'git pull' itself and the underlying 'git merge'
+must be given before the options meant for 'git fetch'.
+
-q::
--quiet::
This is passed to both underlying git-fetch to squelch reporting of
--
1.7.1
next prev parent reply other threads:[~2010-07-26 3:38 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-07-26 0:34 need advice on usage patterns Geoff Russell
2010-07-26 3:36 ` Jonathan Nieder [this message]
2010-07-26 7:16 ` git pull (Re: need advice on usage patterns) Thomas Rast
2010-07-26 20:06 ` Jonathan Nieder
2010-07-27 9:13 ` Thomas Rast
2010-07-26 10:26 ` Ævar Arnfjörð Bjarmason
2010-07-26 10:37 ` Geoff Russell
2010-07-26 14:17 ` Jonathan Nieder
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20100726033634.GA30877@burratino \
--to=jrnieder@gmail.com \
--cc=geoffrey.russell@gmail.com \
--cc=git@drmicha.warpmail.net \
--cc=git@vger.kernel.org \
--cc=trast@student.ethz.ch \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).