(リポジトリ全体で)gitにチェックインされたもののはるかに古いバージョンにロールバックする方法はありますか?リポジトリの内容を変更したくありません。9か月前のリポジトリのローカルコピーが必要です。
2 に答える
2
はい、リポジトリのクローンを作成します...
git clone <repo-url>
... 9か月前から必要なコミット、ブランチ、またはタグを見つけます...
git log
git branch
git tag
...そして古いバージョンをチェックアウトします...
git checkout <commit-sha1, branch, tag>
コミットをチェックアウトすると、分離されたHEADモードになることに注意してください。さらにコミットしたい場合は、そのコミットへのブランチを作成できます。
于 2013-01-08T00:09:06.250 に答える
2
文字通り、9か月前の時点でブランチをチェックアウトするようにgitに指示することができます。これが私のプロジェクトの1つからの例です:
:; git checkout 'master@{9 months ago}'
Checking out files: 100% (625/625), done.
Note: checking out 'master@{9 months ago}'.
You are in 'detached HEAD' state. You can look around, make experimental
changes and commit them, and you can discard any commits you make in this
state without impacting any branches by performing another checkout.
If you want to create a new branch to retain commits you create, you may
do so (now or later) by using -b with the checkout command again. Example:
git checkout -b new_branch_name
HEAD is now at b50869f... ignore DerivedData
リビジョンを指定するすべての方法は、git-rev-parse
マニュアルページに記載されています。
于 2013-01-08T00:15:57.053 に答える