Git Alias for Checkout and Branch Shortcuts

Create git aliases for common branch operations like checkout, branch listing, and switch. Reduce typing with co, br, and sw shortcuts.

Branch Aliases

Detailed Explanation

Checkout and Branch Shortcuts

The most universally adopted git aliases are simple abbreviations for branch operations. These three aliases save thousands of keystrokes over a developer's career:

[alias]
    co = checkout
    br = branch
    sw = switch

Why These Matter

These commands are used dozens of times per day. Typing git co feature-branch instead of git checkout feature-branch saves 5 characters each time. Over months and years, this adds up significantly.

Extended Branch Aliases

Build on the basics with more specific shortcuts:

[alias]
    co  = checkout
    cob = checkout -b
    br  = branch
    brd = branch -d
    brD = branch -D
    sw  = switch
    swc = switch -c
Alias Command Purpose
co checkout Switch branches or restore files
cob checkout -b Create and switch to new branch
br branch List, create, or delete branches
brd branch -d Delete a fully merged branch
brD branch -D Force delete a branch (even unmerged)
sw switch Switch branches (newer, safer alternative to checkout)
swc switch -c Create and switch to new branch

checkout vs switch

Git 2.23 introduced git switch as a focused alternative to git checkout. While checkout can both switch branches and restore files (which can be confusing), switch only switches branches. Many teams are migrating to switch for clarity, but both work fine as aliases.

Use Case

Use these aliases in your daily development workflow whenever you create, switch, or delete branches. They are especially valuable when working with feature branch workflows where you switch between branches many times per day.

Try It — Git Alias Builder

Open full tool