[development] using git, create patch with new files

Dave Cohen drupal at dave-cohen.com
Mon Apr 11 19:53:11 UTC 2011


On Monday 11 April 2011 11:16:12 Michael Favia wrote:
> On 04/11/2011 12:16 PM, Dave Cohen wrote:
> > When I run `git diff`, I see changes to all the modified files, but I do not see the new files.
> Git allows (actually assumes) that a directory might have various 
> degrees of "dirt" in it. Unapplied patches, your half composed manifesto 
> about the importance of not hacking core, etc.
> 
> A git diff just compares the changes in the "tracked" files that git has 
> been told to care about. Its a good neighbor basically.

I suppose if you're a fan of git, you can argue that it is always right.

If you're like me, on the other hand, you might expect something to show up in git diff, after you've run git add.

> 
> To do what you want above, just temporarily tell git to care about your 
> new files with "git add ." or listing them by name and then run "git 
> diff HEAD".

I find that "git diff HEAD" is wrong because I'm not working on HEAD.  Similarly, "git diff origin" does not do the right thing.

However "git diff origin/6.x-3.x" appears to get me both the modified files and also the add files!  Why doesn't git remember that it's origin is the 6.x-3.x branch?


So, to generate a patch, I'm using...

git diff --no-prefix origin/6.x-3.x



Thanks to all for the suggestions.

-Dave



More information about the development mailing list