LoginSignup
1
1

More than 5 years have passed since last update.

GITのコマンドメモ

Last updated at Posted at 2015-01-06

ブランチを跨いだファイルの差分

git diff branch1:file branch2:file

Gitログから変更ファイル一覧

git log --stat --oneline

リポジトリの情報を取得する

git fetch

変更ファイルをワーキングツリーに追加

git add

Addしたファイルをコミット

コメント付き

git commit -m

前回コミットに追加

git commit --amend

変更したファイルを一時保持

git stash

リスト表示

git stash list

変更をリセット

git checkout

カレントディレクトリ以下

git checkout -- .

コンフリクトでカレントブランチを優先 (======以前)を優先

git checkout --ours

コンフリクトでマージブランチを優先 (======以下)を優先

git checkout --theirs

<remote-name>/<branch-name>でローカルブランチを上書き

git reset --hard <remote-name>/<branch-name>

オプション

ショートオプション ロングオプション 説明
… 追加するファイル名を指定します。
-n –dry-run 追加されるファイル名を表示します。実際には追加されません。
-f –force 無視ファイル(.gitignore)を無視して追加します。
-u –update 既にGit管理下にあるファイルの内、変更点のあるものだけをステージします。
-A –all -uの挙動に加え、.gitignore で無視されていないファイルをステージします。
-N –intent-to-add 後にステージされる事を記録します。git diff を使った場合、差分表示が行えます。
–(ハイフン2つ) オプションとファイルを明示的に切り分けます。例えば「-n」という名前のファイルをステージする場合に利用します。

1
1
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
1
1