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

108 Views Asked by At

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
1

There are 1 best solutions below

0
bk2204 On BEST ANSWER

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