On Jun 7, 6:32 am, Dieter Van de Walle <dieter...@gmail.com> wrote:
> This is what happened:
> - Remote branch has commits A B C D E F
> - User has commits A B C X Y Z
>
> User does a pull and is presented with some merge conflicts.
> Novice user does not know how to handle this, and brings his working
> tree back to the state he wants, and in the process annihilates all
> changes of commits D E and F .
>
> This causes the following graph:
> - Remote: A-B-C-D-E-F--------M--
> - User:   A-B-C-------X-Y-Z-/

Since this is a pull, not a push, shoult the chart look like this?

- Remote: A-B-C-D-E-F-------+--
                            |
                            V
- User:   A-B-C-------X-Y-Z-M

> However, in commit M (the merge) all changes of commits D E and F have
> been reverted.
> If however you issue a 'git log' command, this is not visible.
> When looking at the log a file that was changed in commit F, no change
> is listed in commit M.
> => Changes done in a merge commit are not visible!

Is this because, from the point of view of the "User" branch, the
"Remote" commits of D, E, and F were never committed to "User"?  So,
in branch "User", the file that was changed in commit F has never been
changed.  In other words, commit Z and commit M have identical
content, so there is no change to report in 'git log'.

> This means a merge commit is a free pass for anyone to make any
> changes they want, without any traceability of these changes! (Not
> visible in log, not visible with git annotate, ...)

Would the changes become visible and traceable when they are pushed
back to the "Remote" branch?

- Remote: A-B-C-D-E-F-------+--N
                            |  ^
                            V  |
- User:   A-B-C-------X-Y-Z-M--+

At this point, when viewing commit "N", I would expect git to report
that in commit N the changes in D-E-F were reverted.

> If I remove a block of code in commit F, and this is reverted in the merge M, 
> I would expect the following:

But you haven't "reverted" the change from the perspective of the
"User" branch.  Commit F was never committed to Branch "User", so it
is not "reverted" by this merge.

> I would really appreciate any advice on this. Am I wrong in this
> vision, how?
> Maybe my viewpoint is wrong, but this is a no-go for a VCS for me ...
> I hope someone can put this in another perspective ...

I think the problem is that

1. You are assuming that "git log" would show you the difference
between Commit F and Commit M.  In fact, it only shows you the
difference between Commit Z and Commit M.  The "git log" command shows
you changes between commits within a branch, not between branches.

2. You are overlooking that running "git log" on branch "Remote" will
report the changes between Commit F and Commit M if and when Commit M
is committed back to branch Remote (as commit N).

There are two perspectives to consider:

1. The changes within a branch (ex:  the difference between commit Z
and commit M, or between commit F and commit N)

2. The differences between a branch and the parent branch (ex:  the
difference between commit F and commit M)

Normally, "git log" shows you the changes within your branch.  If
commit "M" is identical to commit "Z", then branch "User" has no
changes as a result of commit "M".

If you want to see the changes between two branches, you need to
specify that you want to view the changes between the branches (Commit
F and Commit M), not within the branch (Commit Z and Commit M).

-- 
You received this message because you are subscribed to the Google Groups "Git 
for human beings" group.
To post to this group, send email to git-users@googlegroups.com.
To unsubscribe from this group, send email to 
git-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/git-users?hl=en.

Reply via email to