Re: git diff

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, Oct 12, 2016 at 6:50 AM,  <webmaster@xxxxxxxxxxxxxx> 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@xxxxxxxxxxxxxx> 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



[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]