Magit in Terminal
The following is a script I use to open Magit in current directory from terminal:
#!/usr/bin/env bash
git_root=$(git rev-parse --show-toplevel)
emacsclient -c -n -a emacs -e "(progn (magit-status \"${git_root}\") (delete-other-windows))"
if [[ -f `which osascript` ]]; then
osascript -e "tell application \"Emacs\" to activate"
fi
I put this script in my PATH as magit, so I can just run magit in any git repository from terminal to open Magit in Emacs. The original source for this script comes from Christian Tietze's post, and I have modified it to make it create a new frame with only one window showing Magit status. I also created another script with -nw in place of -c -n and removed the part that activates Emacs to open Magit in TTY Emacs directly.