From: Jonathan Nieder <jrnieder@gmail.com>
To: "r.ductor" <r.ductor@gmail.com>
Cc: git@vger.kernel.org, Jeff King <peff@peff.net>
Subject: [PATCH/RFC] Documentation/checkout: explain behavior wrt local changes
Date: Thu, 6 Jan 2011 16:52:22 -0600 [thread overview]
Message-ID: <20110106225222.GA15900@burratino> (raw)
In-Reply-To: <20110106173522.GB11346@burratino>
Jonathan Nieder wrote:
> Proposed clearer text would be welcome, especially if in the form of
> a patch to Documentation/git-checkout.txt (see Documentation/SubmittingPatches).
Like this, maybe?
-- 8< --
Subject: Documentation/checkout: explain behavior wrt local changes
The current start of the description to "git checkout" tries to
combine an explanation of "git checkout <branch> --" with "git
checkout -- <paths>" and ends up with a muddle (as Jeff noticed).
In particular, the text does not make it obvious that the "git
checkout <branch> --" form does not clobber local changes relative
to the HEAD commit in the worktree and index.
Reported-by: r.ductor <r.ductor@gmail.com>
Helped-by: Jeff King <peff@peff.net>
Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
---
I somehow suspect that a mention of --merge would make this clearer
but good words for it aren't coming at the moment. Improvements
welcome.
Documentation/git-checkout.txt | 14 ++++++++------
1 files changed, 8 insertions(+), 6 deletions(-)
diff --git a/Documentation/git-checkout.txt b/Documentation/git-checkout.txt
index 22d3611..cfb71a8 100644
--- a/Documentation/git-checkout.txt
+++ b/Documentation/git-checkout.txt
@@ -15,16 +15,18 @@ SYNOPSIS
DESCRIPTION
-----------
-Updates files in the working tree to match the version in the index
-or the specified tree. If no paths are given, 'git checkout' will
-also update `HEAD` to set the specified branch as the current
-branch.
+There are two different modes -- one to switch branches and one to
+make some paths in the work tree match the index or specified tree.
'git checkout' [<branch>]::
'git checkout' -b|-B <new_branch> [<start point>]::
- This form switches branches by updating the index, working
- tree, and HEAD to reflect the specified branch.
+ This form switches branches by changing `HEAD` and updating the
+ tracked files to the specified branch. 'git checkout' will
+ stop without doing anything if local changes overlap with
+ changes to the tracked files. (Any local changes that do not
+ overlap with changes from `HEAD` to the specified branch will
+ be preserved.)
+
If `-b` is given, a new branch is created as if linkgit:git-branch[1]
were called and then checked out; in this case you can
--
1.7.4.rc1
next prev parent reply other threads:[~2011-01-06 22:52 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20110106154418.3348.29438.reportbug@localhost>
2011-01-06 17:35 ` git checkout branch behaves differently from what specified in man page Jonathan Nieder
2011-01-06 22:52 ` Jonathan Nieder [this message]
2011-01-07 0:16 ` [PATCH/RFC] Documentation/checkout: explain behavior wrt local changes Junio C Hamano
2011-01-07 14:27 ` r.ductor
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=20110106225222.GA15900@burratino \
--to=jrnieder@gmail.com \
--cc=git@vger.kernel.org \
--cc=peff@peff.net \
--cc=r.ductor@gmail.com \
/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).