Skip to contentSkip to conversation

should git command and git-command be equivalent?

DISCUSSION franky 3 participants 6 messages Jun 15, 2016

lore
Share & tools
lore

franky

author
#0 lore raw

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

#1 lore raw
Quoted 6 lines · franky

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.

Signature · 1 line
Matthieu
author
#2 lore raw
Quoted 3 lines

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"

Quoted 6 lines

--
Matthieu
-
To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

#3 lore raw
Quoted 4 lines · franky
Quoted 3 lines

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.

Quoted 5 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).

Signature · 1 line
Matthieu
#4 lore raw
Quoted 5 lines · Matthieu Moy
Quoted 3 lines · franky
Quoted 3 lines

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).

Quoted 8 lines
Quoted 1 line

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.

#5 lore raw
Quoted 6 lines · David Symonds

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>" ;-).

Signature · 1 line
Matthieu