Re: [PATCH] Clarification for the command "git checkout <branch>"

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Avery Pennarun <apenwarr@xxxxxxxxx> writes:

> On Wed, Mar 17, 2010 at 12:35 PM, Markus Elfring <Markus.Elfring@xxxxxx> wrote:
>> -When <paths> are not given, this command switches branches by
>> -updating the index, working tree, and HEAD to reflect the specified
>> -branch.
> ...
> The new version spends all the time talking about weird exceptions and
> none of the time actually saying what the basic functionality is
> supposed to be.  How about this:
>
> --
> When <paths> are not given, this command switches from your current
> branch to the given branch.  This is done by updating HEAD to point at
> the given branch, reading the new branch's content into the index, and
> checking out the content into your working tree.  Where possible, any
> files you have modified in your current working tree or index remain
> modified in the newly-checked-out branch.  This cannot be done,
> however, when those modified files differ between the old and new
> branches, in which case the checkout will abort in order to avoid
> losing your changes.  You might want to use 'git stash' in this case.
> --

I like the "First state what it conceptually does and for what purpose it
is used.", but isn't this going down to too low-level details without
saying what these low-level details mean to the visible effects?

When <paths> are not given, this command makes the named branch the
current branch, so that a further work will be committed on that branch.

The index and the working tree are updated to the contents of the new
branch, while carrying the uncommitted changes you made so far along with
you.  If you made changes to paths that are different from the current
branch and the new branch, the command will stop you in order to prevent
you from losing your uncommited changes in potential conflicts between
them and the changes between two branches.  You may want retry the command
after recording the local changes (1) in a temporary commit on the current
branch, or (2) by using "git stash".  Alternatively, see "-m" option.
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]