[haiku-development] Re: GIT help

  • From: Pete Goodeve <pete.goodeve@xxxxxxxxxxxx>
  • To: haiku-development@xxxxxxxxxxxxx
  • Date: Mon, 1 Apr 2013 17:18:09 -0700

On Mon, Apr 01, 2013 at 06:22:15PM -0400, Ryan Leavengood wrote:
> On Mon, Apr 1, 2013 at 5:44 PM, John Scipione <jscipione@xxxxxxxxx> wrote:
> >
> > `git diff` shows you the changes you've made since you last committed, so,
> > in this case, it shows you the changes to the rdef file. It is roughly
> > equivalent to svn diff. However, once you've added the files using `git add`
> > staging them for for commit `git diff` no longer shows them to you.
> 
> Further you can see the diff of files you have staged (aka you added
> them) by using git diff --cached.
> 
> So to summarize:
> 
> git diff: shows files that have been changes, but not added or committed.
> git diff --cached: shows file that have been staged but not yet
> committed (and will NOT show other changes that git diff would show)
> git diff origin/master: shows what has changed between your local
> branch and the origin's master branch
> 
> You can also diff against the history in your repo. For example:
> 
> git diff HEAD~2: shows the diff of the last two commits
> 
Thanks everyone for the clarifications.  'git diff' doesn't exactly work
the way I thought it would...

In the end -- after reading more of the manual, which said that 'reset'
is the inverse of 'add -- that's what I did to get back to where I was.

Now it seems that the command to do what I wanted is

  git diff HEAD patchbay

which correctly reports both added and deleted files (whether 'added'
or not).

I'll have to do a commit at some point, I guess, but the description of
'git format-patch' didn't sound to be what I wanted (a diff to attach to
a ticket) so I haven't yet tried it.  Another point I didn't understand is
that I have to *add* all the files in that directory that I want to commit,
even if they are originally in the tree.  Correct? (I guess so, I just did 
that.)

And what about those deleted files?  I just added all the files in the patchbay
directory and they are now marked for commit.  But the three deleted ones
are still marked as "not staged for commit".  I tried 'git add <deleted file>'
and got no complaint, but they're *still* 'not staged'.  Are they going to
stay in the tree after commit?

Thanks again,

        -- Pete --

Other related posts: