🧾 git status:作業状態を確認する
git status は、現在の作業ディレクトリの状態を教えてくれます。
$ git status
On branch main
Your branch is up to date with 'origin/main'.
Changes not staged for commit:
(use "git add <file>..." to update what will be committed)
modified: hello.txt
Untracked files:
(use "git add <file>..." to include in what will be committed)
newfile.txt
🔍 主に以下のことがわかります:
- 現在のブランチ
- 変更済みファイル(未ステージ)
- 未追跡ファイル(新しく作ったファイル)
📚 git log:履歴をたどる
git log は、これまでのコミット履歴を表示するコマンドです。
$ git log
commit e3c1f5c45a7f5fd3aa5a23db9f8b2e2d3ac9e0ad (HEAD -> main)
Author: Alice Example <alice@example.com>
Date: Fri Jul 11 14:35:21 2025 +0900
READMEを追加
commit 7aab8b1e0e0a4e6cb8de879bfc2f29a17cb3893d
Author: Alice Example <alice@example.com>
Date: Thu Jul 10 10:12:33 2025 +0900
初回コミット
📌 各コミットには:
- コミットID(SHA)
- 作者・日付
- メッセージ
🔁 より見やすく表示するには?
おすすめのオプション付き表示:
# シンプル&コンパクト
git log --oneline
# ブランチの流れを可視化
git log --oneline --graph --all --decorate