Harry
Harry

Reputation: 1337

(Git) How can I set parameters using alias

I ofter use the below command

$git commit -am "something message"

After setting alias, unfortunately that'd not work well.

.gitconfig file is

[alias]
    am = "!f(){ git commit -am \"$1\";};f"

And then I tried,

$ git am "modified something logic"

something error occurred.

fatal: could not open 'filepath//modified something logic: No such file or directory

What is wrong to set alias??

Thanks.

Upvotes: 2

Views: 54

Answers (2)

Harry
Harry

Reputation: 1337

As LeGEC advised me, I changed alias to coam instead am.

$ git config --global alias.coam '!f(){ git commit -am "$1";};f'

After that, I can use the below command that is equal to $ git commit -am "something message"

$ git coam "something message"

Upvotes: 0

LeGEC
LeGEC

Reputation: 51780

am is a built in command :

$ git help am

NAME
   git-am - Apply a series of patches from a mailbox

Choose another name for your alias (and check it isn't already taken ...)

Upvotes: 2

Related Questions