5

In Git-Bash I have an alias that executes two commands; update the list of branches for a git repository, then print them:

alias glb='git remote update origin --prune && git branch -a'

How do I do this in ConEmu? Specifically, Cmder for Windows.

Since ConEmu doesn't use quotes with alias, I have to type alias glb=git remote update origin --prune && git branch -a which is interpreted as two separate commands, first alias glb=git remote update origin --prune and then git branch -a.

  • The answer depends on shell you are using and exact place where you are trying to configure alias – Maximus Oct 13 '15 at 22:53
  • It's Cmder for Windows. I updated the question to clarify this. – craigpatik Oct 14 '15 at 11:21
  • I've asked about shell too! cmder is a terminal. – Maximus Oct 14 '15 at 15:35
  • 1
    Actually, if you are using cmd.exe, you may just use double quotes instead of single ones. – Maximus Oct 14 '15 at 15:38
9

Command separator in ConEmu for me (on Windows) is:

$t

So your example would be:

alias glb=git remote update origin --prune $t git branch -a

NOTE: Be sure to restart your conemu window or open a new tab in order for this to apply. - thanks to @vetras for reminding me.

Reference: http://artandlogic.com/2013/06/making-the-windows-command-prompt-suck-slightly-less/

  • 2
    works but we need to close and start cmdr after we update the alias -- if we change the file on an editor. Took some time to get that. – Vetras Nov 22 '16 at 11:58
  • 1
    You can get around having to restart CMDer simply by reloading the aliases via alias /reload. If for some reason that doesn't work, the full command is %SystemRoot%\system32\doskey /macrofile=Path\To\Your\user-aliases.cmd – Nathan Dec 3 '17 at 15:38
3

Open user-aliases.cmd file under \path\to\cmder\config to add the alias directly, then restart the cmder. glb=git remote update origin --prune $t git branch -a

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.