GIT Internals 2/3
--Packfiles--
When you have two nearly identical 22k objects on your disk (each compressed to approximately 7k). Would't it be nice if Git could store one of them in full but then the second object only as the delta between it and the first?
It turns out that it can. The initial format in which Git saves objects on disk is called a "loose" object format. However, occasionally Git packs up serveral of these objects into a single binary file called a "packfile" in order to save space and be more efficient. Git does this if you have too many loose objects around, if you run the git gc command ,or if you push to a remote server.
Once you run git gc, you'll find that most of your objects in your object directory ate gone, and a new pair of files has appeared.The packfile is a single file containing the contents of all the objects that were removed from you filesystem. The index is a file that contains offsets into the packfile so you can quickly seek to a specific object. The git verify-pack plumping command allows you to see what was packed up.
--The Refspec----
The format of the refspec is , first ,an optional', followed by '<src>:<dst>', where '<src>' is the pattern for references on the remote side and '<dst>' is where those references will be tracked locally. The ' tells Git to update the reference even if it isn't a fast-forward. In the default case that is automatically written by a git remote add origin command, Git fetches all the references under refs/heads/ on the server and writes them to refs/remote/origin/ locally. So, if there is a master branch on the server, you can access the log of that branch locally via any of the following:
>git log origin/master
>git log remotes/origin/master
>git log refs/remotes/origin/master
If you want to do a one-time only fetch, you can specify the specific refspec on the command line, too.
>git fetch origin master:refs/remotes/origin/mymaster
>git push origin master:refs/heads/master //push refspec
>git push origin :topic //Because the refspec is <src>:<dst>, by leaving off the <src> part, this basically says to make the topci branch on the remote nothing, which deletes it. Or you can use the newer syntax(available since Git v1.7.0): git push origin --delete topic

浙公網安備 33010602011771號