tags:

views:

189

answers:

3

Hi.

I want to do a Diff between a locally commited change and between the SVN commited last change. i.e. HEAD and what is on SVN Master trunk.

what would be the suitable command?

Cheers

A: 

The simplest way to do it would be making a diff between HEAD and the import of trunk into a git repo.

But if you cannot do a git svn rebase on your current repo because you do not want to import anything (but only see the difference with the SVN repo), you could clone your repo into a second repo where you can at any moment refresh its content with the SVN trunk.

Then you declare a tracking branch and fetch that repo2 in your current repo:

master/HEAD
svn_trunk    # tracks repo2/trunk/HEAD, refreshed by a git svn rebase 

and you can diff:

git diff svn_trunk..HEAD 
VonC
A: 

I tried this:

git diff HEAD~3 HEAD

and it worked as I wanted to see the diff between 3 locally committed changes and the HEAD on trunk.

But was it the right way? It worked though! :)

Priyank
If you know that the last svn rebase was `HEAD~3`, then yes. It should be the same than `git diff HEAD~3..`
VonC
+2  A: 

I assume you're talking about git-svn:

$ git-svn fetch              # get the latest from svn, without merging yet
$ git diff ..remotes/git-svn # or <treeish>..remotes/git-svn

I don't know if remotes/git-svn can be somewhere else. Check with git branch -a.

Jordi Bunster