Skip to content

Latest commit

 

History

History
37 lines (30 loc) · 1.5 KB

20210409082725-git_layer_in_spacemacs.org

File metadata and controls

37 lines (30 loc) · 1.5 KB

Git layer in Spacemacs

Magit is the central component to this layer. Learning how to use it is key.

Some useful commands listed here, but mostly it’s easy to discover what you can do by pressing ? while in a Magit buffer. Change

KeyCommandNotes
SPC g Lmagit-list-repositoriesRequires magit-repository-directories
SPC g smagit-statusPress ? for menu.
  • Unmerged commits will show at the top of the git status screen.

Rebasing

Only a few things in Magit are not intuitive. Rebasing is one of them.

Interactive with -i flag

  • r -i starts an interactive rebase
  • Choose what to rebase onto (tip you’re not limited to the options presented and can override this with whatever you want like HEAD~2 or something)
  • Nagivate up and down and press the letter corresponding to the action (eg s to squash)
  • C-c C-c to commit and proceed to the next prompt or finish.

Interactive

  • r i
  • Navigate to the commit from which you want to start the rebase.
  • C-c C-c
  • Navigate up and down and press the letter corresponding to the action (eg s to squash)
  • C-c C-c to commit and proceed to the next prompt or finish.