Skip to content

Instantly share code, notes, and snippets.

@yashihei
Last active August 29, 2015 14:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save yashihei/5db8c61df3b04985bb11 to your computer and use it in GitHub Desktop.
Save yashihei/5db8c61df3b04985bb11 to your computer and use it in GitHub Desktop.
Gitで何回も忘れてggってるコマンドを書いておく場所

このファイル管理したくないのにcommitしてしまったって時

  • .gitignoreに対象のファイルを追加
  • git rm --cached [filename]

リモートリポジトリにあるコミットを打ち消し

  • revertで歴史を書き換える
  • ブランチぶっ飛ばして入れ替えるなんてしない

過去のコミットを書き換え

  • git commit --amendで直前のコミットを書き換え
  • git rebase [branch]でbranchまでのコミットを書き換え

一部のファイルだけaddしたい場合

  • git add -i
  • updateで選択
  • git add -pでファイルの中身も選択しての
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment