Interview Prep/Git & GitHub/Git internals: objects, refs and the index

What is a refspec and how do you read `+refs/heads/*:refs/remotes/origin/*`?

IntermediateConceptGit internals: objects, refs and the index
Answer

A refspec is [+]<src>:<dst>. This default fetch refspec says: take every branch on the remote and store it under refs/remotes/origin/, and the leading + allows non-fast-forward updates of the tracking ref. Push refspecs work the same way in reverse and can delete refs with an empty source.

git config --get-all remote.origin.fetch
git push origin :old-branch        # delete remote branch
git push origin HEAD:refs/heads/hotfix
All Git & GitHub questions Roadmap: Git & GitHub

More on Git internals: objects, refs and the index