Magit is the famous git client for emacs.

Like many tools in emacs, it is very versatile and can do more than one thing.

Here is a list of some useful command that can save time on a daily basis.

Commit history

  • Direct command M-x magit-log-current
  • Status Buffer l l

Commit history for other branch

  • Direct command M-x magit-log-other
  • Status Buffer l o

Create new branch from changes

Useful when you forgot to switch branches before commiting your work

  • Direct command M-x magit-branch-spinoff
  • Status Buffer b s

Push local branch

To remote

  • Direct command M-x magit-push-to-remote
  • Status Buffer P p

To upstream

  • Direct command M-x magit-push-to-upstream
  • Status Buffer P u

Pull changes from remote

  • Direct command M-x magit-pull-from-upstream
  • Status Buffer F u

Adding to gitignore

  • Direct command M-x magit-gitignore
  • Status Buffer i t