* Mysterious junk in file.... "not commited yet"
@ 2010-04-05 18:13 Howard Miller
2010-04-05 18:52 ` Avery Pennarun
0 siblings, 1 reply; 6+ messages in thread
From: Howard Miller @ 2010-04-05 18:13 UTC (permalink / raw)
To: git
Hi,
I just found a file in my project that has "junk" at the beginning
(looks like some binary stuff at the start of a php file). Git status
and diff show nothing unusual (nothing to commit). Git log shows
nothing I wouldn't expect and show 'shows' show noting. Git blame on
the other shows the offending line as 'not commited yet'. I tried
doing 'git checkout <filename>' but it didn't fix it.
What am I missing? Has git broken somewhere?
Thanks,
Howard
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Mysterious junk in file.... "not commited yet"
2010-04-05 18:13 Mysterious junk in file.... "not commited yet" Howard Miller
@ 2010-04-05 18:52 ` Avery Pennarun
2010-04-05 19:03 ` Howard Miller
0 siblings, 1 reply; 6+ messages in thread
From: Avery Pennarun @ 2010-04-05 18:52 UTC (permalink / raw)
To: Howard Miller; +Cc: git
On Mon, Apr 5, 2010 at 2:13 PM, Howard Miller
<howard@e-learndesign.co.uk> wrote:
> I just found a file in my project that has "junk" at the beginning
> (looks like some binary stuff at the start of a php file). Git status
> and diff show nothing unusual (nothing to commit). Git log shows
> nothing I wouldn't expect and show 'shows' show noting. Git blame on
> the other shows the offending line as 'not commited yet'. I tried
> doing 'git checkout <filename>' but it didn't fix it.
>
> What am I missing? Has git broken somewhere?
You might have 'git add'ed the changed line. Try this:
git checkout HEAD -- <filename>
Have fun,
Avery
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Mysterious junk in file.... "not commited yet"
2010-04-05 18:52 ` Avery Pennarun
@ 2010-04-05 19:03 ` Howard Miller
2010-04-05 19:13 ` Avery Pennarun
2010-04-05 19:24 ` Matthieu Moy
0 siblings, 2 replies; 6+ messages in thread
From: Howard Miller @ 2010-04-05 19:03 UTC (permalink / raw)
To: Avery Pennarun; +Cc: git
>
> You might have 'git add'ed the changed line. Try this:
>
> git checkout HEAD -- <filename>
>
> Have fun,
>
> Avery
>
Hmmm... fixed. I've never even heard of 'git add' before. Why is this
different to plain old 'checkout' without the HEAD?
Anyway... thanks. Day saved :)
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Mysterious junk in file.... "not commited yet"
2010-04-05 19:03 ` Howard Miller
@ 2010-04-05 19:13 ` Avery Pennarun
2010-04-05 19:24 ` Matthieu Moy
1 sibling, 0 replies; 6+ messages in thread
From: Avery Pennarun @ 2010-04-05 19:13 UTC (permalink / raw)
To: Howard Miller; +Cc: git
On Mon, Apr 5, 2010 at 3:03 PM, Howard Miller
<howard@e-learndesign.co.uk> wrote:
>> You might have 'git add'ed the changed line. Try this:
>>
>> git checkout HEAD -- <filename>
>
> Hmmm... fixed. I've never even heard of 'git add' before. Why is this
> different to plain old 'checkout' without the HEAD?
>
> Anyway... thanks. Day saved :)
That ends up being a very long story. You should probably read about
"staging" files in git in a git tutorial somewhere. :)
Glad I could help.
Have fun,
Avery
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Mysterious junk in file.... "not commited yet"
2010-04-05 19:03 ` Howard Miller
2010-04-05 19:13 ` Avery Pennarun
@ 2010-04-05 19:24 ` Matthieu Moy
2010-04-05 19:29 ` Howard Miller
1 sibling, 1 reply; 6+ messages in thread
From: Matthieu Moy @ 2010-04-05 19:24 UTC (permalink / raw)
To: Howard Miller; +Cc: Avery Pennarun, git
Howard Miller <howard@e-learndesign.co.uk> writes:
> Hmmm... fixed. I've never even heard of 'git add' before.
Hmm, maybe it's time to read the manual, then ;-).
> Why is this different to plain old 'checkout' without the HEAD?
Read about the "index" of Git, aka "staging area". It's where Git (and
you) prepare commit, and "git diff" shows you the diff against it.
Plain "git checkout" will read from the index, while "git checkout
HEAD" takes the last commited version.
--
Matthieu Moy
http://www-verimag.imag.fr/~moy/
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Mysterious junk in file.... "not commited yet"
2010-04-05 19:24 ` Matthieu Moy
@ 2010-04-05 19:29 ` Howard Miller
0 siblings, 0 replies; 6+ messages in thread
From: Howard Miller @ 2010-04-05 19:29 UTC (permalink / raw)
To: Matthieu Moy; +Cc: Avery Pennarun, git
> Plain "git checkout" will read from the index, while "git checkout
> HEAD" takes the last commited version.
Cool.... that's the bit I hadn't appreciated. I was (falsely) under
the impression that 'git checkout' grabbed the last committed version.
Suitably educated... thanks!
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2010-04-05 19:29 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-04-05 18:13 Mysterious junk in file.... "not commited yet" Howard Miller
2010-04-05 18:52 ` Avery Pennarun
2010-04-05 19:03 ` Howard Miller
2010-04-05 19:13 ` Avery Pennarun
2010-04-05 19:24 ` Matthieu Moy
2010-04-05 19:29 ` Howard Miller
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).