简体   繁体   English

从 svn 切换到 git:可以在一行中搜索 svn 提交的日志并在 git 中显示提交吗?

[英]Switching from svn to git: Can searching logs for svn commit and showing commit in git be done in a one-liner?

I know that you can search for an svn commit after running git svn using the git log command.我知道您可以在使用git log命令运行git svn后搜索svn commit

Example searching for svn commit r88843:搜索 svn commit r88843 的示例:

git log --grep=git-svn-id:.*@88843

Then you can use the git commit hash to pass into git show然后你可以使用 git commit hash 传入git show

Can this be done in a one-liner?这可以在单线中完成吗?

Similar to (in Linux):类似于(在 Linux 中):

git show < git log --grep=git-svn-id:.*@88843 --pretty=format:%H

If you're looking for a way to view patch output, you can just use the -p option to git log , and it will show the patch output as well as the log information.如果您正在寻找一种查看补丁输出的方法,您可以只对git log使用-p选项,它会显示补丁输出以及日志信息。 That's nearly equivalent to git show and is likely the easiest way to get what you want.这几乎等同于git show并且可能是获得所需内容的最简单方法。

However, if you really want to use git show , you can use either one of the following:但是,如果您真的想使用git show ,则可以使用以下任一方法:

$ git show $(git log --grep=git-svn-id:.*@88843 --pretty=format:%H)

or, if you expect to have many arguments, you can use:或者,如果您希望有很多参数,您可以使用:

$ git log --grep=git-svn-id:.*@88843 --pretty=format:%H | xargs git show

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM