I'm trying to make a setup that will use emacs as a command line tool to switch git branches.
The idea is to run some command in terminal, something like
emacsclient -t -e "(magit-checkout)". This will run emacs window with
(magit-checkout) command executed in my terminal. I can then select a branch from the list, press enter, emacs will then checkout this branch, window will close and I'm back to my terminal.
I can't make it work though, running
emacsclient -t -e "(magit-checkout)" just flashes emacs window in my terminal and closes it immediately. It works almost as I want it to work with
(magit-commit) command (the only thing that doesn't work is that emacs window won't close after the operation is done). But it doesn't work with
(magit-checkout). Is there any way to make it work the way I described?