Targeted answer to this original question:

`git diff` will show you unstaged changes.

`git diff --cached` (or --staged, they are synonyms) will show you
staged changes.

`git diff HEAD` will show you all of these changes together.

And, re: your point:

> 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.

HEAD from CVS days is gone. In Git, HEAD basically refers to whatever's
currently checked out in your working copy - typically the branch you're
currently working on.

cheers
s

On 4/11/11 10:16 AM, Dave Cohen wrote:
> I'm trying, and failing, to create a patch that adds new files to a module.  
> 
> According to http://drupal.org/node/707484, I should simply run `git add ...` 
> then "Next time you run git diff, these new files will be included as well."  
> In my experience, this statement is false.
> 
> When I run `git status`, I see something like this:
> 
> [dave@starbuck fb-3]$ git status
> # On branch 6.x-3.x
> # Changes to be committed:
> #   (use "git reset HEAD <file>..." to unstage)
> #
> #       new file:   fb.process.inc
> #       new file:   fb_tab.js
> #
> # Changes not staged for commit:
> #   (use "git add <file>..." to update what will be committed)
> #   (use "git checkout -- <file>..." to discard changes in working directory)
> #
> #       modified:   README.txt
> #       modified:   contrib/fb_example.module
> #       modified:   fb.module
> #       modified:   fb_canvas.admin.inc
> #       modified:   fb_canvas.module
> #       modified:   fb_devel.module
> #       modified:   fb_settings.inc
> #       modified:   fb_tab.admin.inc
> #       modified:   fb_tab.info
> #       modified:   fb_tab.module
> #       modified:   fb_url_rewrite.inc
> 
> 
> When I run `git diff`, I see changes to all the modified files, but I do not 
> see the new files.
> 
> What am I missing?  Thanks,
> 
> -Dave


Attachment: signature.asc
Description: OpenPGP digital signature

Reply via email to