Information Technology Reference
In-Depth Information
named public-repo/.git/hooks/post-update . The script should contain a
single $ git reset --hard command, as shown in Listing 10-4 .
Hint This recipe can be treated as a deployment tool. The public-repo is the re-
pository where no one works. This is a read-only repository accessible through HTTP
protocol. The recipe shows how you can publish your works on the web with a simple $
git push command.
Summary
When we discuss synchronization we always consider two repositories: local (the one
you issue the command in) and remote (the one available by its URL). To avoid the
chore of typing the URL again and again git can store it locally in the .git/config
file. The remote URLs are managed with the $ git remote command.
The synchronization of git repositories is implemented on the basis of the graph of
revisions. The $ git push command copies the revisions from local repository to
the remote end. When you fetch, the revisions are copied from the remote to the local
repository. In both cases, the database entries are not changed during the trans-
fer—their SHA-1 remains unchanged. You can regard a set of git repositories as a dis-
tributed database where SHA-1 act as primary key. Because SHA-1 hashes are unique
we can copy the items between arbitrary repositories without the risk of colliding keys.
If the key exists in a destination database it is always regarded as the same object.
To explain this, I created in one of my repositories the following revision:
6c69fa3372f7099836176c8d0f123895adea58f1 Unique commit by
gajdaw
The name of this revision is:
6c69fa3372f7099836176c8d0f123895adea58f1
From git's point of view this name is unique in the whole universe —in all known git
repositories. This is a very strong assumption that makes synchronization of repositor-
Search WWH ::




Custom Search