Git Bash Keyboard Shortcuts — Complete Cheatsheet
Git Bash provides a powerful command-line interface for Git operations on Windows, emulating a Unix-like environment. Mastering its keyboard shortcuts can significantly accelerate your workflow and boost your productivity.
Upgrade Your Workflow: MX Master 3S Mouse
Pair your shortcuts with the ultimate developer mouse. Silent clicks, 8K DPI tracking, and hyper-fast scrolling.
Shortcuts
| Action | Windows | Mac | Category |
|---|---|---|---|
| Clear screen | Ctrl+L | Cmd+L | Navigation & Editing |
| Move cursor to beginning of line | Ctrl+A | Cmd+A | Navigation & Editing |
| Move cursor to end of line | Ctrl+E | Cmd+E | Navigation & Editing |
| Delete character before cursor | Ctrl+H / Backspace | Cmd+H / Delete | Navigation & Editing |
| Delete character under cursor | Ctrl+D | Cmd+D | Navigation & Editing |
| Delete word before cursor | Ctrl+W | Cmd+W | Navigation & Editing |
| Delete line from cursor to beginning | Ctrl+U | Cmd+U | Navigation & Editing |
| Delete line from cursor to end | Ctrl+K | Cmd+K | Navigation & Editing |
| Paste last cut text | Ctrl+Y | Cmd+Y | Navigation & Editing |
| Recall previous command from history | Up Arrow | Up Arrow | History & Search |
| Recall next command from history | Down Arrow | Down Arrow | History & Search |
| Search history (reverse incremental search) | Ctrl+R | Cmd+R | History & Search |
| Interrupt/terminate current process | Ctrl+C | Cmd+C | Process Control |
| Suspend current process | Ctrl+Z | Cmd+Z | Process Control |
| Exit Git Bash session | exit | exit | Session Management |
| Autocomplete command/path | Tab | Tab | Productivity |
| List possible autocompletions | Tab (twice) | Tab (twice) | Productivity |
| Move cursor one word backward | Alt+B | Option+B | Navigation & Editing |
| Move cursor one word forward | Alt+F | Option+F | Navigation & Editing |
| Transpose characters | Ctrl+T | Cmd+T | Navigation & Editing |
| Transpose words | Alt+T | Option+T | Navigation & Editing |
| Capitalize word under cursor | Alt+C | Option+C | Navigation & Editing |
| Make word under cursor lowercase | Alt+L | Option+L | Navigation & Editing |
| Make word under cursor uppercase | Alt+U | Option+U | Navigation & Editing |
Tips
- Practice regularly: The more you use these shortcuts, the more they'll become second nature, significantly speeding up your command-line interactions.
- Combine shortcuts: Many shortcuts can be chained together for complex editing tasks, like `Ctrl+A` then `Ctrl+K` to quickly delete an entire line and start fresh.
- Leverage Tab completion: Don't type full commands or file paths; use `Tab` for autocompletion to prevent typos and save time.
- Explore `Ctrl+R` for history: This is a powerful way to find and reuse past commands without endless scrolling.
Frequently Asked Questions
How do I see all Git Bash shortcuts?
Git Bash uses GNU Readline for its command-line editing. You can view many of its key bindings by typing `bind -P` in your terminal. However, this list can be extensive and includes many less commonly used bindings.
Can I customise Git Bash shortcuts?
Yes, you can customise Readline key bindings by creating or editing the `~/.inputrc` file. This file allows you to map specific key combinations to Readline functions. For example, you could add `"\C-p": previous-history` to map Ctrl+P to the previous history command.