i found image graphically show work of diff command. http://images.abizern.org.s3.amazonaws.com/365git/march10/gitdiffsimple.png
git diff head
show changes have in working tree relative head, if run script
mkdir test_git cd test_git git init echo 'one_file.txt' >> one_file.txt git add . git commit -m "my first commit" echo 'second_file.txt' >> second_file.txt git diff head
then diff don't show diff of seconrd_file.txt. why?
the git diff
command provides relative difference between current working directory or current index respect head
. in example above creating new file have not added index or committed it. in terms of head
new file not exist , not tracked there no difference. staging file in index git add second_file.txt
introduce new file repository , yield diff when executing git diff --cached
command.
the process of tracking changes explained in detail in freely available in pro git - 2.2 git basics.
Comments
Post a Comment