How can I use the 'diff -u' command to generate patches that can be applied to a 'git/sv', repository? I am intending to run the diff command on a 'git-svn' repo.
Asked
Active
Viewed 375 times
1 Answers
0
If you're generating the patch on a Git repo (which a git-svn
repo counts as), and planning to apply it to another Git/git-svn
repo, then you should probably use Git's regular patch utilities (e.g. git diff
and git format-patch
).

Amber
- 507,862
- 82
- 626
- 550
-
I have used git diff but the caveat is that it produces a diff with git specific headers 'diff --git a/afile b/afile' which makes applying it on an svn repo a nightmare for my other teammates. I am more looking at generating a patch that will apply uniformly across repo - more like what tortoise svn generates. – Feb 28 '12 at 08:20
-
Standard utilities like `patch` ignore that `diff --git` thing on header. What problem are you experiencing? – J-16 SDiZ Feb 28 '12 at 08:33
-
I use patch and it works well but the team does not want to use patch. They prefer to use eclipse > patch > apply. All I want is a way to use the unix diff command to generate a patch on a git-svn repo? – Feb 28 '12 at 08:39
-
Maybe try the svn-compatible diff script listed here, then: http://mojodna.net/2009/02/24/my-work-git-workflow.html – Amber Feb 29 '12 at 06:39
-
Thanks for the suggestion but I would appreciate if you explained how to use diff to generate a patch. – Feb 29 '12 at 11:59
-
this page has the answer I was looking for: https://trac.openxdata.org/wiki/UsingGitSvn – Mar 26 '12 at 16:25