[plt-dev] git wackiness

From: Jay McCarthy (jay.mccarthy at gmail.com)
Date: Tue Apr 20 17:21:10 EDT 2010

I've discovered some git wackiness that others may learn from.

I thought "git add" meant "reminder this file to include in the next
commit". However, that's wrong:

echo foo > tst
git add tst
echo bar > tst
git commit
git push

git pull
cat tst # prints "bar"

Lesson 1: git add copies your file off somewhere hidden


I don't get the whole git index thing, so I started using "git commit
-a" but that finds ALL modified files, not just ones in the CWD. "git
commit ." finds only those modified files in the current directory.


In SVN you could commit to a directory/files if no one else had
committed even if you aren't at the HEAD. I just tried to commit to
meta/drdr and git insisted I update to whole tree. (This obviously
sucks for PLT when there's been a C change that makes updating break
everything until you spend 20 minutes re-running setup-plt.)

Kevin gave me this magic advice:

tewk: This might work, git branch working_point; git pull --rebase ;
git push ; git checkout working_point
tewk: git branch saves your current view of the world, which you can
come back to after you update and commit

I didn't try it because I don't understand it, but now you know if
this happens to you.


Jay McCarthy <jay at cs.byu.edu>
Assistant Professor / Brigham Young University

"The glory of God is Intelligence" - D&C 93

Posted on the dev mailing list.