Re: which git commands is correponding to "svnlook diff -t" and "svnlook log -t"?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxx>
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]