git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Mike Rappazzo <rappazzo@gmail.com>
To: webmaster@peter-speer.de
Cc: git <git@vger.kernel.org>
Subject: Re: git diff
Date: Wed, 12 Oct 2016 07:06:05 -0400	[thread overview]
Message-ID: <CANoM8SUtrV8CD8M=4CUB8xr9gQj_hKzGOdjQZHuz4+36y_UfJw@mail.gmail.com> (raw)
In-Reply-To: <1066408917.43087.1476269456819.JavaMail.open-xchange@app06.ox.hosteurope.de>

On Wed, Oct 12, 2016 at 6:50 AM,  <webmaster@peter-speer.de> wrote:
> Hi.
>
> I created a new branch named hotfix from master.
> I switched to the branch, changed 1 file.
>
> Now I want to see the diff from the both using
>
> git diff hotfix master
>
> I do not see any output (difference).
> When I do a git status I see my file with status mofified, not staged for
> commit.

Since you just created the branch, and did not add any content, there
is no difference to see.  A branch is just a pointer to a commit.  You
now have two pointers pointing at the same commit.

If you want to see the difference between your changes and the master
branch, you can omit the first reference:

    git diff master

When you start adding commits to your hotfix branch, you will be able
to see the diff between that and master with the command that you
gave.  However, your arguments may be in the reverse order than what
you expect.  You want to specify master first because that is the
mainline branch (I presume).

When you have several commits on your hotfix branch, you can refer to
older commits to diff against.  There are several ways to refer back,
but the simplest is to use a tilde '~' followed by a number to count
back.  For example 'hotfix~1' refers to the parent commit on the
hotfix branch.  There is a lot in the documentation[1], so take a look
there for more info.

Good luck.
_Mike

[1] https://git-scm.com/doc


> Also, I can see that I am working with the correct branch, hotfix
>
> What am I doing wrong?
>
> -fuz

On Wed, Oct 12, 2016 at 6:50 AM,  <webmaster@peter-speer.de> wrote:
> Hi.
>
> I created a new branch named hotfix from master.
> I switched to the branch, changed 1 file.
>
> Now I want to see the diff from the both using
>
> git diff hotfix master
>
> I do not see any output (difference).
> When I do a git status I see my file with status mofified, not staged for
> commit.
> Also, I can see that I am working with the correct branch, hotfix
>
> What am I doing wrong?
>
> -fuz

  reply	other threads:[~2016-10-12 11:06 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-10-12 10:50 git diff webmaster
2016-10-12 11:06 ` Mike Rappazzo [this message]
2016-10-12 13:51   ` webmaster
     [not found] <AANLkTi=ASvicFGaaDfqxjOxJELWPLKsQwvk7rEeT36Fh@mail.gmail.com>
2011-01-13 22:46 ` Carter Lamb
2011-01-17 22:30   ` Jeff King

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: http://vger.kernel.org/majordomo-info.html

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CANoM8SUtrV8CD8M=4CUB8xr9gQj_hKzGOdjQZHuz4+36y_UfJw@mail.gmail.com' \
    --to=rappazzo@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=webmaster@peter-speer.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).