The first thing to note is that git aliases only work with shell commands when prefixed with a bang (exclamation mark).
I'm not using git-ftp so I can't test your precise command, but I used git remote show origin
instead because it's very verbose on one of my repos.
I found the following git alias worked fine: sh = "!git remote show origin | awk 'NR<7'"
I therefore expect this git alias to be a solution for you:
sh = "!git ftp show | awk 'NR<7'"
Realise that some bang/pipe/quote combinations work as git aliases, while others will fail, possibly with "fatal bad config line".
Most often the real problem is how quotes are used. The trick can be to just change your particular git alias shell command line to eliminate or change quote usage.
For instance one requirement for a git alias that I had, I worked around the quote problem by changing a sed
command to tr
. I then had to double escape a backslash using: ...| tr \\\\n
.
For this particular question, although I don't think git-alias has a problem with the quotes, a more quote-safe solution would be:
sh = ! git ftp show | head -6
While most readers may already know about the requirement to shell out with a bang, they may not realise that quoting is a more difficult issue.
Although not entirely correct, I found this article was useful for ideas: https://www.atlassian.com/blog/git/advanced-git-aliases
sh = "! git ftp show | awk 'NR<7' "
. – ElpieKay