简体   繁体   中英

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.

Example searching for svn commit r88843:

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

Then you can use the git commit hash to pass into git show

Can this be done in a one-liner?

Similar to (in 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. That's nearly equivalent to git show and is likely the easiest way to get what you want.

However, if you really want to use git show , you can use either one of the following:

$ 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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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