mkamran94
mkamran94

Reputation: 58

Windows Terminal or Powershell alias function that accepts parameters

I want a simple alias I can run to

git add -A
git commit -m "$parm1"
git push

that's all. I'd take any help at this rate. Powershell is well horrible compared to Linux terminals but I'm trying to learn.

    function gitup {
    params(
    [string] $msg
    )

    git add -A
    git commit -m " $msg "
    git push
}

Upvotes: 0

Views: 212

Answers (1)

OwlsSleeping
OwlsSleeping

Reputation: 1570

You have a typo, it's "param" not "params".

As for having this as a convenient alias, it's recommended to put a function like this in your profile.

A question with more detail about profiles- How do I add a PowerShell cmdlet or function to my machine so that it is always available?

Upvotes: 1

Related Questions