0
0

More than 1 year has passed since last update.

自分用 git チートシート

Last updated at Posted at 2022-10-02

コミットをまとめる

git rebase -i HEAD~5
  • p: 残すコミット
  • s: 使うが前のコミットに溶かす

未追跡ファイルを消す

git clean -df
  • git clean は未追跡のファイルを操作するコマンド
  • 危険な操作なため、 -i, -n, -f のいずれかを使わないと実行できない
  • -f : 強制実行
  • -n : ドライラン、対象の確認
  • -d : ディレクトリを含む

直前のコミットを取り消す

git reset --soft HEAD^
git commit git add ファイルの変更 どうなる?
--hard 取消 取消 取消 全部無かったことになる
--mixed 取消 取消 - git addする前になる
--soft 取消 - - git addした後になる
0
0
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
0
0