Search code examples
gitaliasfish

fishshell aliases using &&


When making aliases using fishshell I am running into issues when trying to execute commands with &&.

eg. alias gac 'git add . && git commit -m'

&& is not apparently allowed in fishshell and you are supposed to use & or and.

other things that don't work:
alias gac 'git add . & git commit -m'
alias gac 'git add . and git commit -m'

Any help would be appreciated.


Solution

  • and is a command, so it needs to be separated from the command that came before

    alias gac 'git add .; and git commit -m'
    

    or

    function gac -a commit_msg
        git add .
        and git commit -m $commit_msg
    end