From: Linus Torvalds <torvalds@osdl.org>
To: walt <wa1ter@myrealbox.com>
Cc: git@vger.kernel.org
Subject: Re: My first git success [not quite]
Date: Sat, 14 Jan 2006 13:57:07 -0800 (PST) [thread overview]
Message-ID: <Pine.LNX.4.64.0601141350590.13339@g5.osdl.org> (raw)
In-Reply-To: <dqbnl1$3si$1@sea.gmane.org>
On Sat, 14 Jan 2006, walt wrote:
>
> Linus Torvalds wrote:
> [...]
> > Now, what happens is that when you change branches with a dirty tree, the
> > "git checkout" will do one of two things:
> >
> > - if the dirty files are _identical_ in both branches...
>
> I'm sorry to be quibbling over semantics, truly I am! But here
> is my confusion: if modified-but-uncommitted (hence dirty) files
> are not associated with *any* branch, then how could 'dirty' files
> be 'in' both branches (or 'in' any branch at all)?
The file itself is associated with the branch. It's just that the _dirty_
part isn't.
Of course, you can also truly have files that aren't associated with
either branch at all: files that haven't gotten committed at all. They're
also "dirty state", and exactly like modifications to known files, they
are carried along with the switch, so they'll exist in the directory tree
after a "git checkout".
Anyway, in git, a "branch" is technically really nothing more than "top of
a commit chain". If you look into the files that describe a branch, you'll
literally just find the name of the top commit. Do a
cat .git/refs/heads/master
to see.
So anything that isn't described by that commit is by definition "dirty
state", whether it's because you've edited something (but not checked it
in) or because there's some random generated file in the working tree.
So when you switch branches, you really should think of it as "ok, the
committed state was switched around", and everything else was just "moved
along".
Linus
next prev parent reply other threads:[~2006-01-14 21:57 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-01-13 14:51 My first git success walt
2006-01-13 17:11 ` Linus Torvalds
2006-01-13 18:57 ` Randal L. Schwartz
2006-01-13 19:37 ` Junio C Hamano
2006-01-13 20:14 ` Peter Eriksen
2006-01-14 15:39 ` My first git success [not quite] walt
[not found] ` <20060114105504.157248db.seanlkml@sympatico.ca>
2006-01-14 15:55 ` sean
2006-01-14 17:18 ` walt
2006-01-14 17:48 ` Randal L. Schwartz
2006-01-14 20:31 ` Junio C Hamano
2006-01-14 19:25 ` Linus Torvalds
2006-01-14 20:41 ` walt
2006-01-14 20:49 ` Junio C Hamano
2006-01-14 21:57 ` Linus Torvalds [this message]
2006-01-15 10:44 ` Junio C Hamano
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=Pine.LNX.4.64.0601141350590.13339@g5.osdl.org \
--to=torvalds@osdl.org \
--cc=git@vger.kernel.org \
--cc=wa1ter@myrealbox.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).