Git常用コマンド早見表
292字程度1分以内
2026-01-06
Git常用コマンド早見表
ヒント
master: デフォルトの開発ブランチ origin: デフォルトのリモートリポジトリ Head: デフォルトの開発ブランチ Head^: Head の前回のコミット
リポジトリ/ローカルリポジトリの作成
git clone url
# リモートリポジトリをクローン
git init
# ローカルリポジトリを初期化変更とコミット
git status
# ステータスを確認
git diff
# 変更内容を確認
git add
# 変更されたすべてのファイルを追跡
git add file
# 指定したファイルを追跡
git mv old new
# ファイル名の変更
git rm file
# ファイルを削除
git rm --cached file
# ファイルの追跡を停止(削除しない)
git commit -m "commit message"
# 更新されたすべてのファイルをコミット
git commit --amend
# 最後のコミットを修正コミット履歴の確認
git log
# コミット履歴を確認
git log -p file
# 指定ファイルのコミット履歴を確認
git blame file
# 指定ファイルのコミット履歴をリスト形式で確認取り消し
git reset --head HEAD
# 作業ディレクトリ内の未コミットファイルの変更をすべて取り消し
git checkout HEAD file
# 指定した未コミットファイルの変更を取り消し
git revert commit
# 指定したコミットを取り消しブランチとタグ
git branch
# すべてのローカルブランチを表示
git checkout branch/tag
# 指定したブランチまたはタグに切り替え
git branch new-branch
# 新しいブランチを作成
git branch -d branch
# ローカルブランチを削除
git tag
# すべてのローカルタグを一覧表示
git tag tagname
# 最新のコミットに基づいてタグを作成
git tag -d tagname
# タグを削除マージとリベース
git merge branch
# 指定ブランチを現在のブランチにマージ
git rebase branch
# 指定ブランチを現在のブランチにリベースマージリモート操作
git remote -v
# リモートリポジトリ情報を確認
git remote show remote
# 指定リモートリポジトリの情報を確認
git remote add remote url
# リモートリポジトリを追加
git fetch remote
# リモートリポジトリからコードを取得
git pull remote branch
# コードをダウンロードして高速マージ
git push remote branch
# コードをアップロードして高速マージ
git push remote :branch/tag-name
# リモートブランチまたはタグを削除
git push --tags
# すべてのタグをアップロード変更履歴
2026/01/09 12:40
全ての変更履歴を表示
f8f53-add database section日
