---
title: git チートシート
title_en: git cheatsheet
created: 2026-05-01
tags: [git, shell]
lang: ja
draft: false
---

## 基本操作

```bash
# ブランチ作成・切替
git switch -c feature/my-branch

# 直前のコミットを修正（push 前のみ）
git commit --amend --no-edit

# リモートの変更を取り込みつつ rebase
git pull --rebase origin main
```

## ログ

```bash
# グラフ表示
git log --oneline --graph --all

# 特定ファイルの変更履歴
git log -p -- path/to/file
```

## stash

```bash
# 特定ファイルだけ stash
git stash push -m "wip" src/main.rs

# stash リスト確認
git stash list

# 適用して削除
git stash pop
```
