threads / discuss / 10298

should git command and git-command be equivalent?

Subject: should git command and git-command be equivalent?

## tl;dr

6 messages between Oct 16, 2007 and Oct 16, 2007.

replies: 5people: 3as markdown or json

franky· Oct 16, 2007, 03:22 UTC · lore
	I use git-init frequently and it confuses me for a long time that I
can't init a bare repository. 
	I just found I can do that by "git -bare init". However, I get used
to "git-init" and I always tried "git-init -bare" (of course failed)
	And I thought git-init and "git init" were always the same as most
newbies of git. So, should git init and git-init be equivalent? If not, I
think the document should be supplemented to clarify this.
 franky
Matthieu Moy· Oct 16, 2007, 07:48 UTC · re: franky · lore

Re: should git command and git-command be equivalent?

"franky" <yinping@kooxoo.com> writes:
Show 6 quoted lines
> 	I use git-init frequently and it confuses me for a long time that I
> can't init a bare repository. 
> 	I just found I can do that by "git -bare init". However, I get used
> to "git-init" and I always tried "git-init -bare" (of course failed)
> 	And I thought git-init and "git init" were always the same as most
> newbies of git.

AFAIK, git-init and "git init" are equivalent, but as you noticed already, the advantage of "git init" is that you can pass options to the git command, not only to the "init" subcommand.

Also, you can use aliases (for example, I type "git st" to do "git status") with "git whatever", but not with "git-whatever" (unless you define the alias in your shell).

The git-whatever syntax is more or less deprecated, although I guess it will stay forever at least for compatibility.

-- 
Matthieu
franky· Oct 16, 2007, 08:47 UTC · re: Matthieu Moy · lore

RE: should git command and git-command be equivalent?

> Also, you can use aliases (for example, I type "git st" to do "git
> status") with "git whatever", but not with "git-whatever" (unless you
> define the alias in your shell).

I try "git st", but it complains "git: 'st' is not a git-command". Instead, I use gt-beginning abbreviation for some command frequently used such as gtci->git-commit, gtco-->git-checkout, gtst-->git-status, gtdi->git-diff, gtinit->git-init

So it will be wonderful if I can use "gtinit --bare"
Show 6 quoted lines
> --
> Matthieu
> -
> To unsubscribe from this list: send the line "unsubscribe git" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
Matthieu Moy· Oct 16, 2007, 08:55 UTC · re: franky · lore

Re: should git command and git-command be equivalent?

"franky" <yinping@kooxoo.com> writes:
>> Also, you can use aliases (for example, I type "git st" to do "git
>> status") with "git whatever", but not with "git-whatever" (unless you
>> define the alias in your shell).
> I try "git st", but it complains "git: 'st' is not a git-command".
Sure, I'm talking about aliases, so what I meant is that I had
[alias]
	st = status
in ~/.gitconfig.
Show 5 quoted lines
> Instead, I use gt-beginning abbreviation for some command frequently used
> such as gtci->git-commit, gtco-->git-checkout, gtst-->git-status,
> gtdi->git-diff, gtinit->git-init
>
> So it will be wonderful if I can use "gtinit --bare"

You can't without defining gtinit as a simple-but-not-totally-trivial wrapper script.

But you can define an alias to init, to enable you to type
$ git --bare i

(that said, it could be a good idea for "git init" to accept --bare as an option too).

-- 
Matthieu
David Symonds· Oct 16, 2007, 12:28 UTC · re: Matthieu Moy · lore

Re: should git command and git-command be equivalent?

On 16/10/2007, Matthieu Moy <Matthieu.Moy@imag.fr> wrote:
Show 13 quoted lines
> "franky" <yinping@kooxoo.com> writes:
>
> >> Also, you can use aliases (for example, I type "git st" to do "git
> >> status") with "git whatever", but not with "git-whatever" (unless you
> >> define the alias in your shell).
> > I try "git st", but it complains "git: 'st' is not a git-command".
>
> Sure, I'm talking about aliases, so what I meant is that I had
>
> [alias]
>         st = status
>
> in ~/.gitconfig.

If you use the contrib/completion/git-completion.bash script, you can type "git st<TAB>", and it'll complete it for you. Well, it did, until git-stash came along and ruined it...

At any rate, the bash completion also completes things like branch names, which can be immensely helpful.

Dave.
Matthieu Moy· Oct 16, 2007, 14:46 UTC · re: David Symonds · lore

Re: should git command and git-command be equivalent?

"David Symonds" <dsymonds@gmail.com> writes:
Show 6 quoted lines
> If you use the contrib/completion/git-completion.bash script, you can
> type "git st<TAB>", and it'll complete it for you. Well, it did, until
> git-stash came along and ruined it...
>
> At any rate, the bash completion also completes things like branch
> names, which can be immensely helpful.
I don't use bash, but the zsh completion for git is also excellent.
But "git st" is still one less key to type than "git st<tab>" ;-).
-- 
Matthieu

← back to recent threads