[haiku-development] Re: GIT help

  • From: John Scipione <jscipione@xxxxxxxxx>
  • To: "haiku-development@xxxxxxxxxxxxx" <haiku-development@xxxxxxxxxxxxx>
  • Date: Mon, 1 Apr 2013 17:44:27 -0400

On Mon, Apr 1, 2013 at 5:31 PM, Pete Goodeve <pete.goodeve@xxxxxxxxxxxx>wrote:

> Seems I can't get anything right round here... (:-()
>
> I revised the patchbay directory in my GIT tree, and reached the point
> where I decided to make a 'git diff patchbay'.  When I looked at it,
> though, I realized that I had added an rdef file to the directory
> (as well as deleting a couple of obsolete ones), so I did a 'git add .'
> and tried again.
>
> Now the diff file (which overwrote the nearly good one) contains
> *only* the rdef addition and the deletions.  All the essential stuff
> has gone!
>
> Before I screw things up further, can someone suggest how I
> can rectify things?  (I only did the add, no commit or anything.)
>

Hi Pete,

First, calm down, don't worry, you haven't lost anything. If you're used to
svn, git may confuse you a bit since it works differently.

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

Now, the git way to handle this is to commit the changes to your local
repo, and then run `git format patch` to get a nice git formatted patch
file.

If you'd like to see the changes using `git diff` though, you still can,
but you need to look relative to a remote instead of relative to your local
branch. To do this, run `git diff origin/master` or whatever your remote
branch is called. That should show you the local changes relative to your
remote.

John Scipione

Other related posts: