[development] using git, create patch with new files

Dave Cohen drupal at dave-cohen.com
Mon Apr 11 20:32:04 UTC 2011


On Monday 11 April 2011 13:09:20 Michael Favia wrote:

> I'm no more  a"fan" of git than i am of drupal. Its a tool that has good 
> value if you know how to use it and can frustrate the hell out of you if 
> you dont.

Let's just say it frustrates the hell out of me.  :)

> It just has one more layer of intelligence/workflow that allows it/you 
> to ignore changes in your working copy that you don't want to pay 
> attention right now.

In my case there are modified files, and added files, and I want git to pay attention to both of those groups.

> > 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.
> You find that its wrong or it doesnt work? These are two different things.

Wrong for my case, I meant.  I thought I tried both "git diff HEAD" and "git diff origin" and both produced a diff with too many changes.  But I tried again, and "git diff HEAD" did what I wanted.  So I guess I was seeing things for a moment there.

git diff origin             <--- does the wrong thing, in my case
git diff HEAD             <--- appears to work
git diff origin/6.x-3.x  <-- appears to work, in my case

(I also add --no-prefix when running git diff, at least when I remember)

> 
> HEAD is a special dynamic variable that refers to the most recent commit 
> in the index. It is there so you don't have to type in the whole commits 
> crazy ass SHA name. In that way it works EXACTLY like a named version 
> tag.  (fyi HEAD^ equals "next to last commit" so git "diff HEAD^ HEAD" 
> shows you the diff between the last commit and the one before it).
> 

Thanks for explaining that.

-Dave


More information about the development mailing list