GitHub

David Golden xdaveg at gmail.com
Sun May 31 17:53:22 GMT 2009


On Sun, May 31, 2009 at 5:25 AM, Shlomi Fish <shlomif at iglu.org.il> wrote:
> What are refspecs and why should I care? Why doesn't a simple push operation
> just works and does the right thing? And why did it broke all of a sudden?

I'd bet you created or checked out a branch.  "git clone" adds a
section to your .git/config file (called "[branch master]") that sets
a default for "git push" from the master branch.  If you're on a
different branch, then git doesn't know where it should push to or
what the name of the remote branch is.

> This is just a tiny example. I also had many problems with "git checkout" and
> "git diff" no longer showing the diff for files that were "git add"'ed and
> other aspects.

If it's still available -- pre-publication proof mentioned in boston.pm:

 ftp://ftp.oreilly.com/outgoing/Version_Control_with_Git.zip.

I thought it was quite good.

A big conceptual leap in git is the so-called 'index' -- which is a
sometimes described as a "staging area" between your working directory
and the actual local repository.  However, after reading that O'reilly
draft, what I realized is that the index is really just the "future
commit" -- the next node in the commit graph of the current branch --
but one that hasn't actually been linked to the branch yet.

So  "git add <path>" stages the current changes to the future commit
and "git commit" is what actually updates the branch pointer.  "git
diff" by default shows the difference between your working set and
*the index*, not the branch..  "git diff --cached" will show the
difference from the index to the branch.

A "refspec" is annoying vague jargon but more or less means "anything
that git can interpret as a reference to a particular point in the
commit graph".  git has a lot of heuristics to guess/expand from a
fragment which is why examples are sometimes confusing.  Usually you
can think of it as a branch name, which is really just a path in
.git/refs/heads, .git/refs/remotes.

And, yes, +1 for a move to git.

-- David


More information about the tapx-dev mailing list