8

We have recently converted our SVN repositories to GIT. It seems that we lost some commits by this conversion and would like to verify this.

So we would like to find a matching git commit for each svn commit to check whether the conversion has actually occured.

$ git log|grep "some partial commit message" will not suffice as it only walks through direct ancenstors and ignores branches that are not direct ancestors.

$ git show <commit-hash> will not work as svn doesn't have sha1sums.

the closest thing I found was: $ git reflog show --all --grep="releasenotes"|xargs git show --shortstat however this doesn't seem to completely work as it seems to grep in more places than just the commit message (We got a false positive).

I also tried to use this: $ git rev-list --all|xargs -n1 bash -c 'git show|head -n10'|grep -i release

basically I'm lacking a good method to print the commit message without the diffs.

[EDIT]

I'm not exactly sure but I guess this should list all commit messages in the repository.

git rev-list --all|xargs -n1 git log -n1
Alexander Oh
  • 24,223
  • 14
  • 73
  • 76
  • Reading the manpage for git-log will help: you can use something like `git log --all --format= | grep `, where `` would be something like "SHA - commit message" as detailed by the man page – Nevik Rehnel Dec 19 '12 at 15:04

3 Answers3

17

You can just use the --all option for git log

git log --all --oneline --graph --decorate | grep "message"

Which is equivalent to

git log --all --oneline --graph --decorate --grep "message"

Or if you would prefer to have the context and don't have a lot of commits you might want to do something like

git log --all --oneline --graph --decorate | less
/ message

And that way you can see where your commits are with respect to other commits.

Pablo Fernandez heelhook
  • 11,985
  • 3
  • 21
  • 20
9

You could use the --grep option of git log:

$ git log --all --grep=word

See "How to grep git commits for a certain word": this is for grepping commit messages.

Community
  • 1
  • 1
VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
1

You can also use GUI.

gitk

It will open a GUI, then write your commit message in containing box, and hit enter key.

It will show all matching commits with highlighted.

Raghvendra Parashar
  • 3,883
  • 1
  • 23
  • 36