I used git to track changes in a project. The first couple of commits were all about setting up the environment and including a bunch of plugins to get a bare framework.
How do i start a new project starting from one of the old commits from my existing project?
You could use git archive
:
git archive --format=zip --prefix MyNewProj/ <oldcommit> -o ../basicproject.zip
cd ..
unzip basicproject.zip
cd MyNewProj
git init
This will create a zip archive of all tracked files (not any ignored, like binaries) at the commit <oldcommit>
. Then you can unzip it into a new project.
您可以从任何旧点创建分支:
git checkout -b topic <oldpoint>
Note that using a zip format can be problematic on very large repo, depending on the unzip software used (especially on Windows).
That is what git 2.6 (Q3/Q4 2005) addresses:
See commit 88329ca , commit 0f747f9 , commit 19ee294 (22 Aug 2015) by René Scharfe.
Suggested-by: Johannes Schauer .
(Merged by Junio C Hamano -- gitster
-- in commit 565f575 , 01 Sep 2015)
archive-zip
: support more than 65535 entriesSupport more than 65535 entries cleanly by writing a "zip64 end of central directory record" (with a 64-bit field for the number of entries) before the usual "end of central directory record" (which contains only a 16-bit field).
InfoZIP's zip does the same.
Archives with 65535 or less entries are not affected.Programs that extract all files like InfoZIP's zip and 7-Zip ignored the field and could extract all files already.
Software that relies on the ZIP file directory to show a list of contained files quickly to simulate to normal directory like Windows'built-in ZIP functionality only saw a subset of the included files .Windows supports ZIP64 since Vista .
Here, that should not matter, unless the commit is a very large one.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.