[git-users] Re: What does this line in git diff mean?

2014-07-29 Thread Rick Umali
On Tuesday, July 29, 2014 12:31:27 PM UTC-4, juh wrote:

 1. What does the line with the word index mean? 


The line with the index refers to the two 'files' that Git is comparing. 

In your example, the line index 4202174..6ef3a44 100644 breaks down
like this: 

4202174 is a/text.md
6ef3a44 is b/text.md
100644 is the 'mode', or permissions of the file

The a in a/text.md represents the original file, and the b in b/text.md 
represents 
the file in your working directory.

You can use git show 4202174 to dump the contents of the original file in 
case
you've forgotten what it looks like. As for b/text.md, it lives only in 
your working
directory, but to get its SHA1 ID number, you can use:

git hash-object text.md

This should yield a SHA1 ID that starts with 6ef3a44.

2. What does the line with the @@ mean? 


As pointed out earlier, the @@ are 'hunks'. Another reference I use to 
describe
these diff hunks is here:

http://www.gnu.org/software/diffutils/manual/html_node/Detailed-Unified.html

The hunk describes which lines from the source file and which lines from 
the 
destination file are being compared. In @@ -3,3 +3,4 @@, we're comparing 
from the original file (-), starting at line 3, 3 lines (-3,3) with a 
target file (+) starting
at line 3, going 4 lines.

I recommend using graphical tools to look at differences. These numbers are 
meant
for tools that will patch up the files.
--
Rick Umali / http://www.manning.com/umali 
 

-- 
You received this message because you are subscribed to the Google Groups Git 
for human beings group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to git-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [git-users] Re: What does this line in git diff mean?

2014-07-29 Thread juh
Thanks a lot, Philip and Rick!

Now I understand.

juh

-- 
You received this message because you are subscribed to the Google Groups Git 
for human beings group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to git-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.