天天看點

Git - Cloning Specific Commits 使用git clone指定的commit問題:需要獲得指定commit的倉庫版本

問題:需要獲得指定commit的倉庫版本

方法1:gitub tree view

1.1點選如圖紅框所示,檢視曆史commit

Git - Cloning Specific Commits 使用git clone指定的commit問題:需要獲得指定commit的倉庫版本

1.2 點選紅框處進入到該次commit時的倉庫狀态

Git - Cloning Specific Commits 使用git clone指定的commit問題:需要獲得指定commit的倉庫版本

1.3 點選紅框出zip檔案下載下傳即可

Git - Cloning Specific Commits 使用git clone指定的commit問題:需要獲得指定commit的倉庫版本

方法2:Clone The Repo And Checkout The Specific Commit

2.1 設定HEAD指向commit_sha

git clone -n <repo_url>

cd repo

git checkout <commit_sha>

Git - Cloning Specific Commits 使用git clone指定的commit問題:需要獲得指定commit的倉庫版本

點選紅框處複制

<commit_sha>

2.2 Clone The Repo And Checkout The Specific Commit Into A Branch

git clone -n <repo_name>

cd repo

git checkout -b <new_branch> <commit_sha>