1. Basic Navigation
    1. Commits View
  2. Staging
  3. Switch Branches
    1. Switch branches with dirty tree
  4. Discarding
    1. Stashing
  5. Reset to a commit
  6. Pull Requests
  7. Rebasing
    1. Onto origin/master
  8. Amending Commits
    1. Fixup
      1. Squash fixups
  9. Create Revert Commit
  10. Patching Old Commits
  11. Merge Conflicts

Basic Navigation

  • x to open menu
  • Shift+P to push
  • p to pull
  • f to fetch
  • (In general) ␣ to select
  • Switch between panes with ← →

Commits View

  • Press enter on a commit to view file tree
    • Exit with ⎋

Staging

  • Select in “Files” with arrow keys
  • Press ␣ to stage
    • Or press a to add all
    • Or press ⏎
      • go through lines with ↑ ↓
      • press ␣ on relevant lines
        • use v to start a range
      • move to diff pane with tab
        • Press d on a line to unstage
  • Press c to commit

Switch Branches

  • Choose branch
  • Press ␣

Switch branches with dirty tree

  • Choose branch
  • Press ␣
  • Select autostash (with stash/pop)
    • May need merge conflict resolve

Discarding

  • Move to Diff view and press d on lines
  • Use d in Files pane to discard the file changes
  • Shift+D

Stashing

  • All files
    • Focus Files pane
    • Press s
  • Individual files
    • Stage the files you want to stash
    • Press Shift+S

Reset to a commit

  • Select commit to go to in Commits
  • Press g to revert changes into staging area

Pull Requests

  • Press o
  • Opens PR in browser

Rebasing

Recap: Pull → Checkout feature branch → Make commits → Checkout master → Pull → Rebase → Push

  • In Commits Pane,
  • Press e
  • Select commit with arrow keys
    • Squash
      • Press s
    • Edit → Press e
    • Pick → Press p
    • Fixup → Press f
    • Drop → Press d
    • Reorder with Ctrl+J, Ctrl+k
  • Press m to exit

Onto origin/master

  • On feature branch
  • Press f to fetch (master)
  • Press r to initiate r ebase
  • Resolve conflict
  • Press Shift+P to push

Amending Commits

  • Stage amendments
  • Select commit in Commits pane
  • Press a to add staged changes

Fixup

  • Stage amendments
  • Select commit in Commits pane
  • Shift + F

Squash fixups

  • Squash fixups
    • Select commit below the commit to be squash into
    • Shift+S

Create Revert Commit

  • Select commit in Commits pane
  • Press t

Patching Old Commits

Moving a change from one old commit to a new commit

  • Select commit in Commits pane
  • Press ⏎⏎
  • Select line
  • Press ␣ to add to a custom patch
  • Press 2*⎋
  • Select target commit
  • Press Ctrl+P

Merge Conflicts

  • Select path to choose
    • Or use b to select both changes
  • Press ␣