Git コマンドチートシート
よく使う Git コマンドの分類別早見表。基本操作、ブランチ管理、リモート、取り消しなどを網羅。 完全無料・会員登録不要・ブラウザ内ローカル処理・アップロード不要。
Basic
git init— Initialize a new repositoryクリックでコピーgit clone <url>— Clone a remote repositoryクリックでコピーgit status— Show working tree statusクリックでコピーgit add <file>— Stage file(s) for commitクリックでコピーgit add .— Stage all changesクリックでコピーgit commit -m "msg"— Commit staged changesクリックでコピーgit diff— Show unstaged changesクリックでコピーgit diff --staged— Show staged changesクリックでコピーBranch
git branch— List local branchesクリックでコピーgit branch <name>— Create a new branchクリックでコピーgit checkout <branch>— Switch to branchクリックでコピーgit checkout -b <name>— Create & switch to branchクリックでコピーgit switch <branch>— Switch to branch (new)クリックでコピーgit switch -c <name>— Create & switch (new)クリックでコピーgit merge <branch>— Merge branch into currentクリックでコピーgit branch -d <name>— Delete a branchクリックでコピーgit branch -m <old> <new>— Rename a branchクリックでコピーRemote
git remote -v— List remote repositoriesクリックでコピーgit remote add <name> <url>— Add a remoteクリックでコピーgit fetch— Fetch from remoteクリックでコピーgit pull— Fetch & mergeクリックでコピーgit push— Push to remoteクリックでコピーgit push -u origin <branch>— Push & set upstreamクリックでコピーgit remote remove <name>— Remove a remoteクリックでコピーUndo/Reset
git reset HEAD <file>— Unstage a fileクリックでコピーgit checkout -- <file>— Discard working changesクリックでコピーgit restore <file>— Discard working changes (new)クリックでコピーgit reset --soft HEAD~1— Undo last commit, keep stagedクリックでコピーgit reset --mixed HEAD~1— Undo last commit, keep unstagedクリックでコピーgit reset --hard HEAD~1— Undo last commit, discard allクリックでコピーgit revert <commit>— Create undo commitクリックでコピーStash
git stash— Stash current changesクリックでコピーgit stash list— List stashesクリックでコピーgit stash pop— Apply & remove latest stashクリックでコピーgit stash apply— Apply latest stashクリックでコピーgit stash drop— Remove latest stashクリックでコピーgit stash push -m "msg"— Stash with a messageクリックでコピーLog
git log— Show commit historyクリックでコピーgit log --oneline— Compact commit historyクリックでコピーgit log --graph— Graph of branchesクリックでコピーgit log -n <count>— Show last N commitsクリックでコピーgit show <commit>— Show commit detailsクリックでコピーgit blame <file>— Line-by-line historyクリックでコピーTag
git tag— List tagsクリックでコピーgit tag <name>— Create lightweight tagクリックでコピーgit tag -a <name> -m "msg"— Create annotated tagクリックでコピーgit tag -d <name>— Delete a tagクリックでコピーgit push origin --tags— Push tags to remoteクリックでコピー