LoginSignup
0
0

More than 3 years have passed since last update.

【Git】GitLabでクローンすることなく古いコミットが欲しい

Last updated at Posted at 2019-12-08

こんな状況に出くわした

リポジトリがでかすぎて私の激遅回線ではクローンするのに1日かかってしまう!
※イメージ
でかすぎポジトリ

今回はこのリポジトリ下から2番目のコミットFirst Commit(e24b3ba0f2d9d367d4758ccfafa4aef0e90b804a)が欲しいのだ
First Commit

実験

当然、クローンしていないので

git checkout e24b3ba0f2d9d367d4758ccfafa4aef0e90b804a

などとはできない。
そして、

git fetch origin e24b3ba0f2d9d367d4758ccfafa4aef0e90b804a:refs/remotes/origin/template

などとしても、

error: Server does not allow request for unadvertised object e24b3ba0f2d9d367d4758ccfafa4aef0e90b804a

と怒られてしまう

結論

Web上からタグを作ってしまおう 1

方法

タグ画面から
GitLab Tags
New tagを押して
New tag
Tag nameは適当、Create FromにコミットIDを打ち込んで
New tag
Create tagを押す

あとは
git initなどでリポジトリを作り、git remote set-url origin <URL>などでリモートを設定後、
タグ名でフェッチできる

git fetch origin template:refs/remotes/origin/template

あとはチェックアウトするだけ

git checkout -b template refs/tags/template

  1. 書き込み権限がないリポジトリの場合はフォークしましょう 

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0