git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: Aliasing with parameters doesn't seem to work properly in git 1.7.0.5

From
Jacob Helwig <jacob.helwig@gmail.com>
Date
Jun 3, 2010, 14:55 UTC
Message-ID
<AANLkTikWBzHLCQzC57bZQwCB6MxOYS8R5Y-UBZoh_ndS@mail.gmail.com>
In-Reply-To
<AANLkTilEZknW7m0n3y8SX5oAaZiUTorgqfX3jTB8mnDC@mail.gmail.com>
On Thu, Jun 3, 2010 at 07:52, Eugene Sajine <euguess@gmail.com> wrote:
Show 29 quoted lines
> Hi,
>
> i'm trying to create an alias like this:
>
> cln = !sh -c 'git clone git://server/"$1"'
>
> the idea is to make a shortcut, so instead of command like this:
>
> $git clone git://server/folder/repo.git
>
> i can have something like this:
>
> $git cln folder/repo.git
>
> or even
> $git cln folder/repo
>
> if the alias is like this:
> cln = !sh -c 'git clone git://server/"$1".git'
>
> this doesn't work as it tries to initialize a repo called server.git
> and then fails because "remote hang up unexpecedly"
> is there something wrong in expansion of this alias or the alias
> itself is not valid?
>
> Any ideas?
>
> Thanks,
> Eugene
You need " -" at the end of your alias for the parameters to get through.
Try using:
cln = !sh -c 'git clone git://server/"$1"' -
or
cln = !sh -c 'git clone git://server/"$1".git' -
Previous: Eugene SajineNext: Eugene Sajine
Message 2 of 4 in “Aliasing with parameters doesn't seem to work properly in git 1.7.0.5”
  1. Eugene SajineJun 3, 2010
  2. Jacob HelwigJun 3, 2010
  3. Eugene SajineJun 3, 2010
  4. Santi BéjarJun 3, 2010

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.