[GLLUG] Really weird behaviour from git

John Winters john at sinodun.org.uk
Thu Jan 2 12:11:18 UTC 2014


I set out to do a bit of bug fixing today, but I'm being stymied by some 
really weird behaviour from git.  Things seem to be getting staged 
without me asking for them to be.  An illustrative transcript, cut and 
pasted from my terminal session:

john at nuc:~/Work/Coding/markbook/importsb/code$ git status
# On branch master
# Changes to be committed:
#   (use "git reset HEAD <file>..." to unstage)
#
#	new file:   ../../notes/Calendar/2014/01/02.txt
#
# Changes not staged for commit:
#   (use "git add <file>..." to update what will be committed)
#   (use "git checkout -- <file>..." to discard changes in working 
directory)
#
#	modified:   database.rb
#	modified:   setrecord.rb
#
# Untracked files:
#   (use "git add <file>..." to include in what will be committed)
#
#	able.txt
john at nuc:~/Work/Coding/markbook/importsb/code$ git diff setrecord.rb
john at nuc:~/Work/Coding/markbook/importsb/code$ git status
# On branch master
# Changes to be committed:
#   (use "git reset HEAD <file>..." to unstage)
#
#	new file:   able.txt
#	modified:   database.rb
#	modified:   setrecord.rb
#	new file:   ../../notes/Calendar/2014/01/02.txt
#
john at nuc:~/Work/Coding/markbook/importsb/code$



Note that to start with I have two modified but un-staged files, and one 
new file also un-staged.  I issue a "git diff" to see the changes in 
setrecord.rb and it says there are none.  Then I do another git status, 
and suddenly those three files are now staged.

Can anyone explain this?  It's never happened to me before.

John




More information about the GLLUG mailing list