git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jan Hudec <bulb@ucw.cz>
To: samilkarahan <samilkarahan@yahoo.com>
Cc: git@vger.kernel.org
Subject: Re: which git commands is  correponding to "svnlook diff -t" and "svnlook log -t"?
Date: Thu, 11 Nov 2010 09:47:23 +0100	[thread overview]
Message-ID: <20101111084723.GD30870@efreet.light.src> (raw)
In-Reply-To: <30111518.post@talk.nabble.com>

On Tue, Nov 02, 2010 at 00:03:31 -0700, samilkarahan wrote:
> I have developed pre-commit hook, but it only run for svn hook. 
> 
> I want to run it for git hook,But I don't know git well like svn ,so 

Git works fundamentally differently from subversion. It's not possible to
give you good advice unless you explain what you want to do in the hook.

Where subversion has one commit operation to create the changeset and publish
it, git has two operations. Commit to create it and push to publish it. Each
comes with it's own set of hooks. Moreover the operations are done on
different repositories, so they run hooks from different places!

Commit has 'pre-commit', 'prepare-commit-msg', 'commit-msg' and 'post-commit'
run on the developers local repositories, where they must be manually
installed and can be easily disabled (with --no-verify option to commit).
The prepare-commit-msg gives you some extra flexibility in that you can
prepare template of the commit message here.

Push has 'pre-receive', 'update', 'post-receive' and 'post-update' run on the
central repository and there is no way around them. It is, however, kind of
late. The commits are already done, perhaps even for quite a long time, so if
they are rejected, developers will have to go back and amend them.

Remember, that multiple commits will be pushed at once, so you have to
inspect all of them (git log $oldsha..$newsha), not just the latest.

> I haven't found corresponding git command to svn commands which are "svnlook
> diff -t"

Depends on which git hook you want that in. And that depends on what you want
to do. For pre-commit hook, it's 'git diff --cached', for pre-receive or
update hook you get the commit ID and inspect it with 'git log' and 'git
show'.

> and "svnlook log -t".

Again, depends on which git hook you want that in. And that depends on what
you want to do. For pre-commit hook there is none, since it's called
*before* the message is created. For commit-msg hook you get name of file
with the message as argument (and you can edit it from there). For
pre-receive hook or update hook you use 'git log' and 'git show' again.

> is there anybody know these git commands??

Everybody knows them plus they are quite obvious from the documentation (man
git-hooks) and the samples (installed by 'git init' in every repository). But
nobody knows the subversion commands and there is no simple mapping anyway.

-- 
						 Jan 'Bulb' Hudec <bulb@ucw.cz>

      parent reply	other threads:[~2010-11-11  8:47 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-11-02  7:03 which git commands is correponding to "svnlook diff -t" and "svnlook log -t"? samilkarahan
2010-11-02  9:03 ` Matthieu Moy
2010-11-02  9:13   ` Mathias Lafeldt
2010-11-11  8:47 ` Jan Hudec [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20101111084723.GD30870@efreet.light.src \
    --to=bulb@ucw.cz \
    --cc=git@vger.kernel.org \
    --cc=samilkarahan@yahoo.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).