Today i typed git commit
without the file name i was thinking of, and strange things happened.
usually it would just tell me "use a filename or -a, dummie", but this time it showed:
$ git commit -m "some change"
[master 1d75411] some change
37 files changed, 1566 insertions(+), 1189 deletions(-)
create mode 100644 fileA
create mode 100644 fileb
[...]
delete mode 100644 fileC
delete mode 100644 fileD
[...]
and those changes are already appearing on the server! like if i did a push
or merge
!!!
Everything is exactly the same as before despite the file i was trying to commit anyway.
No file was deleted, no file was changed. Unix permissions are the same as before!
What happened?!
Edit: now, after every two commits, this happens:
$ git status
* nothing changed *
$ git diff
* nothing *
$ edit somefile
$ git commit -m "some change" somefile
[master f875c5b] some change
21 files changed, 4 insertions(+), 1563 deletions(-)
delete mode 100644 fileA
delete mode 100644 fileB
delete mode 100644 fileC
[...] (somefile does not even appear on the console output, only if i get log later)
$ git status
# On branch master
# Changes to be committed:
# (use "git reset HEAD <file>..." to unstage)
#
# new file: fileA
# new file: fileB
# new file: fileC
[...]
$ git commit -m "re-add files? why?"
$ git push
$ git status
* nothing changed *
$ git diff
* nothing *
$ edit somefile
$ git commit -m "some change" somefile
[master f875c5b] some change
21 files changed, 4 insertions(+), 1563 deletions(-)
delete mode 100644 fileA
delete mode 100644 fileB
delete mode 100644 fileC
[...]
$ git status
# On branch master
# Changes to be committed:
# (use "git reset HEAD <file>..." to unstage)
#
# new file: fileA
# new file: fileB
# new file: fileC
[...]
That's it. i will just take that i'm not smart enough for git and host this project in Subversion. Do not need much history at this stage anyway, so it can be lost for now.
I may give it another go after i have the time to read the git book entirely.
thanks for trying to help, but this just got too weird and unproductive.
also, out of curiosity to someone, my work flow so far have been (two months doing this and everything was fine until today)
$ git fetch
$ git merge origin/master master
$ edit file
$ git add somenewfile
$ git commit -m 'somethin开发者_运维问答g changed' file somenewfile
$ git push
Since no one can explain this, i'm closing assuming it's a bug.
leaving here just if someone search this in the future.
i've sent the logs to the devs, never heard back, but since there's a few revisions after the one i was using, i will just assume it was fixed... but i will never know since not using git on this project anymore.
Just looks like the normal behaviour when your specify files in your commit command :
http://git-scm.com/docs/git-commit :
File>…
When files are given on the command line, the command commits the contents of the named files, without recording the changes already staged. The contents of these files are also staged for the next commit on top of what have been staged before.
精彩评论