Git development
 help / color / mirror / Atom feed
From: seanh <snhmnd@gmail.com>
To: git@vger.kernel.org
Subject: git commit not committing, confused
Date: Fri, 25 Feb 2011 19:02:35 +0000	[thread overview]
Message-ID: <20110225190235.GB15815@kisimul> (raw)

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!

                 reply	other threads:[~2011-02-25 18:57 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20110225190235.GB15815@kisimul \
    --to=snhmnd@gmail.com \
    --cc=git@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox