9

When I use git diff --relative HEAD^..HEAD, I get some nice output for a patch that I strip out the path outside the directory it is in.

I am starting to use git format-patch and I would like to also use --relative but don't see any options for that. How would I get the same effect?

Thanks

Wilfred Hughes
  • 29,846
  • 15
  • 139
  • 192
Elijah Lynn
  • 12,272
  • 10
  • 61
  • 91
  • `--relative` is missing in the (newer?) docs. Maybe it is deprecated. It is documented for this version: https://git-scm.com/docs/git-format-patch/1.6.0 – Brent Bradburn Dec 11 '17 at 04:30
  • It isn't in the format-patch docs per say, it is in the git diff docs. So try `git help diff` and you will see --relative in their. – Elijah Lynn Dec 11 '17 at 16:42

1 Answers1

8

git help format-patch shows

   git format-patch [-k] [(-o|--output-directory) <dir> | --stdout]
   ...
                      **[<common diff options>]**

So, just git format-patch --relative.

kan
  • 28,279
  • 7
  • 71
  • 101
  • 1
    Thanks! I had just searched the page for relative didn't see anything. You just taught me something even bigger than this one thing. I am now wondering how many man pages have similar descriptions in their arguments list!! – Elijah Lynn May 01 '13 at 18:14
  • 1
    https://git-scm.com/docs/git-diff#git-diff---relativeltpathgt is one such man page section.. – Philip Oakley Apr 27 '18 at 18:02