• 追加された行はこの色です。
  • 削除された行はこの色です。
* git reset(git addの取り消し) [#j2afffca]
* git reset(git add/commitの取り消し) [#j2afffca]

** ステージングを取り消す [#l5b26aec]
 git add test.txt
 git reset HEAD test.txt

** (コミットしてすぐの場合の)コミットを取り消す [#ve9b0731]
 git commit -am 'XXX'
 git reset --hard HEAD^

** (コミットして時間が経っていて、すでに他者が修正を行っている可能性が高い場合の)コミットを取り消す [#g90f15df]
 自分:
 git commit -am 'XXX'
 git push

 他者:
 git pull
 git commit -am 'XXX'

 自分:
 git revert HEAD
 git push

 (他者)
 git pull

** 参考 [#t880fec6]
- http://d.hatena.ne.jp/murank/20110327/1301224770
- http://transitive.info/article/git/command/reset/
- http://d.hatena.ne.jp/zariganitosh/20080905/1220621182


トップ   新規 一覧 検索 最終更新   ヘルプ   最終更新のRSS