git commit not committing, confused

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



How did this happen?

I have a git repo containing a LOG.txt file. I made some changes to this
file and committed them. Actually, I called this script which did so:

	#!/bin/sh -e
	# Append timestamped one-liners to a file and commit the file to git.
	logdir=~/txt
	logfile=LOG.txt
	cd "$logdir"
	if [ $# = 0 ]; then
		# No command-line arguments, just print out the last entry.
		tail -n 1 $logfile
	else
		entry="[`date`] [`hostname`] $*"
		echo $entry >> $logfile
		git commit $logfile -m "$logfile: $*"
		git push
		tail -n 1 $logfile
	fi

The script executes (and shows output from git) with no errors. `git
log` shows the commit, `git log -p` shows the changes committed to the
LOG.txt file.

However, `git log LOG.txt` does _not_ show the commit.
`git status` shows LOG.txt as modified and unstaged.
`git diff LOG.txt` shows a diff of the changes to LOG.txt, the same changes so
that show up in `git log -P`.
After running `git add LOG.txt` again, `git status` still shows LOG.txt
as modified and unstaged!
`git commit LOG.txt` reports 'no changes added to commit'.

So this doesn't make sense. I don't know what happened or how. git's
index seems to have got into a mess. If I clone the repo then cd into
the clone and run git status it shows LOG.txt as modified and unstaged,
even though this is a brand new fresh clone!
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]