4
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

GIT で過去バージョンをリモートリポジトリに複製する

Last updated at Posted at 2015-08-09

0. 目的と背景

目的:ローカルリポジトリの環境を、過去のバージョンに戻す。
背景:不具合を特定するために、環境まるごと過去の状況に戻したかったため。

1. リモートリポジトリから、ローカルリポジトリに clone する。

bash
$ git clone http://your.web.com/path/to/yourdir.git

2. GitLabから取得したリポジトリのSHAを取得する。

あらかじめGitLabからSHAを取得してください。このSHAをcheckoutすることで、過去のバージョンに戻ることができます。

bash
$git checkout [SHA]

例:

bash
$git checkout 8f49a7cd73069b4rhh9fa4b7247309bec7d7458e

※ブランチを指定する場合:

bash
$git checkout 8f49a7cd73069b4rhh9fa4b7247309bec7d7458e -b branch

※特定のファイルだけ元に戻したい場合:

bash
$git checkout 8f49a7cd73069b4rhh9fa4b7247309bec7d7458e /path/to/yourfile

3. 参考:

ご指摘・コメント等いただけましたら幸いです。

れりごー

4
2
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
4
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?