Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
1.5k views
in Technique[技术] by (71.8m points)

is it possible to git clone from a specific commit point

NOTE: there is an edit to this question below

I have used git clone ssh://etc before to pull a remote repository

Is there a way to clone that repository from a specific commit point?

I'm wanting to pull only what happened on master say from 1 year ago. The repo is 14 years old and huge.

If this is not possible, is there a way to clone the repo, and then locally compact everything (including all indexes and so forth) into a single "pseudo" commit as if it was the initial code commit? Thanks.

Edits:

The accepted answer found here does not work in this case. The process only pulls down a repo of the same size, and the entire history is still available (and takes up space).

owilliams@OWILLIAMS010451 ~ % du -sh xms_v*                                                                                                                                                                                3:32:56
1.6G    xms_v3
1.6G    xms_v3_ObjectExplorer
1.4G    xms_v3_shallow           <-- no change

Not shown but if I move the .git folder out of the repo, the size is only 524M.

Here is what it looks like in SourceTree: enter image description here

What I am wanting is to see a single commit with a matching the remote, and what I would a assume as a "pseudo" squashed commit prior to that, as if that was my first code commit.

question from:https://stackoverflow.com/questions/65895458/is-it-possible-to-git-clone-from-a-specific-commit-point

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)
Waitting for answers

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...