* git commit not committing, confused
@ 2011-02-25 19:02 seanh
0 siblings, 0 replies; only message in thread
From: seanh @ 2011-02-25 19:02 UTC (permalink / raw)
To: git
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!
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2011-02-25 18:57 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-02-25 19:02 git commit not committing, confused seanh
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).