{"thread":{"id":"26604","subject":"git commit not committing, confused","startedAt":"2011-02-25T19:02:35Z","lastAt":"2011-02-25T19:02:35Z","messageCount":1,"participants":["seanh"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"162249","messageId":"20110225190235.GB15815@kisimul","threadId":"26604","inReplyTo":null,"subject":"git commit not committing, confused","fromName":"seanh","fromEmail":"snhmnd@gmail.com","sentAt":"2011-02-25T19:02:35Z","receivedAt":"2011-02-25T19:02:35Z","isPatch":false,"sender":{"key":"snhmnd@gmail.com","avatar":null},"body":"How did this happen?\n\nI have a git repo containing a LOG.txt file. I made some changes to this\nfile and committed them. Actually, I called this script which did so:\n\n\t#!/bin/sh -e\n\t# Append timestamped one-liners to a file and commit the file to git.\n\tlogdir=~/txt\n\tlogfile=LOG.txt\n\tcd \"$logdir\"\n\tif [ $# = 0 ]; then\n\t\t# No command-line arguments, just print out the last entry.\n\t\ttail -n 1 $logfile\n\telse\n\t\tentry=\"[`date`] [`hostname`] $*\"\n\t\techo $entry >> $logfile\n\t\tgit commit $logfile -m \"$logfile: $*\"\n\t\tgit push\n\t\ttail -n 1 $logfile\n\tfi\n\nThe script executes (and shows output from git) with no errors. `git\nlog` shows the commit, `git log -p` shows the changes committed to the\nLOG.txt file.\n\nHowever, `git log LOG.txt` does _not_ show the commit.\n`git status` shows LOG.txt as modified and unstaged.\n`git diff LOG.txt` shows a diff of the changes to LOG.txt, the same changes so\nthat show up in `git log -P`.\nAfter running `git add LOG.txt` again, `git status` still shows LOG.txt\nas modified and unstaged!\n`git commit LOG.txt` reports 'no changes added to commit'.\n\nSo this doesn't make sense. I don't know what happened or how. git's\nindex seems to have got into a mess. If I clone the repo then cd into\nthe clone and run git status it shows LOG.txt as modified and unstaged,\neven though this is a brand new fresh clone!\n"}]}