[GLLUG] Really weird behaviour from git

James Courtier-Dutton james.dutton at gmail.com
Thu Jan 2 12:29:49 UTC 2014


On 2 January 2014 12:11, John Winters <john at sinodun.org.uk> wrote:
> 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.
>

You must are doing something.
For example, only a "git add" would have moved the able.txt to the
"changes to be commited" list.
Are you editing them in a IDE, or with something else like VIM?
The IDE might be doing git commands for you behind the scenes.
Is there a cron job doing the git adds?
Do you have shell aliases set up, that might be doing git adds when
you type something else.
type "aliases" to find out.




More information about the GLLUG mailing list