0
@@ -139,6 +139,58 @@ Git records every hash of a commit it computes in `.git/logs`. The subdirectory
0
Eventually, you may want to run *git gc \--prune* to recover space. Be aware that doing so prevents you from recovering lost HEADs.
0
+Want to migrate a project to Git? If it's managed with one of the more well-known systems, then chances are someone has already written a script to export the whole history to Git.
0
+Otherwise, take a look at *git fast-import*. This command takes text input in a specific format and creates Git history from scratch. Typically a script is cobbled together and run once to feed this command, migrating the project in a single shot.
0
+As an example, paste the following listing into temporary file, such as `/tmp/history`:
0
+----------------------------------
0
+commit refs/heads/master
0
+committer "Alice" <alice@example.com> Thu, 01 Jan 1970 00:00:00 +0000
0
+M 100644 inline hello.c
0
+ printf("Hello, world!\n");
0
+commit refs/heads/master
0
+committer "Bob" <bob@example.com> Tue, 14 Mar 2000 01:59:26 -0800
0
+Replace printf() with write().
0
+M 100644 inline hello.c
0
+ write(1, "Hello, world!\n", 14);
0
+----------------------------------
0
+Then create a Git repository from this temporary file by typing:
0
+ $ mkdir project; cd project; git init
0
+ $ git fast-import < /tmp/history
0
+You can checkout the latest version of the project with:
0
+ $ git checkout master .
0
=== Building On Git ===
0
In true UNIX fashion, Git's design allows it to be easily used as a low-level component of other programs. There are GUI interfaces, web interfaces, alternative command-line interfaces, and perhaps soon you will have a script or two of your own that calls Git.
Comments
No one has commented yet.