#author("2022-01-20T13:19:02+09:00","default:ryuichi","ryuichi")
#author("2022-01-20T13:22:20+09:00","default:ryuichi","ryuichi")
* 修正・削除したファイルを元に戻す [#p91d87d5]

** 修正したファイルを戻す [#h09d1325]

 vi 1.txt
 vi 1.txt                   # (1)
 git checkout 1.txt

*** 任意のリビジョンに戻す [#l47a7610]

 vi 1.txt
 git checkout abc123 1.txt  # (2)
 git checkout HEAD 1.txt    # (3)
 
- (2) リビジョンabc123に戻す
- (3) HEADに戻す。(1)と同じ意味

** 削除したファイルを戻す [#l214870b]

 rm 1.txt            # (1)
 git restore 1.txt

 git rm 1.txt        # (2)
 git restore 1.txt

- (1)シェルで削除した場合も(2)git rmで削除した場合も、
- コマンド'''git restore'''で戻せる

** git addでステージに上げたファイルを戻す [#i5d8220a]

 vi 1.txt        # (1)
 git add 1.txt
 git reset 1.txt

- '''git add''は取り消されるが、ファイルの内容は(1)で修正されたまま

トップ   編集 差分 バックアップ 添付 複製 名前変更 リロード   新規 一覧 検索 最終更新   ヘルプ   最終更新のRSS