Skip to content

Instantly share code, notes, and snippets.

@infotroph
Created April 10, 2019 10:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save infotroph/bafb1871a76cbcef20460fdbad3cca26 to your computer and use it in GitHub Desktop.
Save infotroph/bafb1871a76cbcef20460fdbad3cca26 to your computer and use it in GitHub Desktop.
Why does touching a file mark it changed in diff-index but not status? And then why does status mark it unchanged for diff-index?
0> git init
Initialized empty Git repository in /Users/chrisb/git_test/.git/
0> echo "some\ncontent" >> foo.txt
0> git add .
0> git commit -m 'first'
[master (root-commit) 3e1a325] first
1 file changed, 2 insertions(+)
create mode 100644 foo.txt
0> git diff-index HEAD
0> touch foo.txt
0> git diff-index HEAD
:100644 100644 6cfc2af7f5fbb8cd7cb226e7a70d1829a0678767 0000000000000000000000000000000000000000 M foo.txt
0> git status
On branch master
nothing to commit, working tree clean
0> git diff-index HEAD
0>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment