Why does GitHub desktop present history as if it w

2019-02-22 04:55发布

问题:

I'm using Git in a team of three to build an iOS app. For this project we are all Mac and Xcode based and have a variety of different ways of using Git: within Xcode, using Github Desktop, and from the Bash terminal.

I am confused about the history I am seeing in GitHub desktop - it is linear and appears to be all from one developer.

I can use the terminal command git log --since='2016-05-06' --pretty=format:"%h %an %cd" --graph to see the last few days' commits:

I can clearly see that the last twelve commits are spread between all three contributors. But it does not look like this in GitDesktop:

Here all the recent commits seem to be from one developer, and all laid out linearly without the branching structure shown by the --graph option to git log.

Why is GitHub desktop presenting the history as one developer? Where is the branching structure gone? How do I get GitHub Desktop to show me the history that git log is able to?

回答1:

I heard back from the GitHub team.

The terminal command that is a better comparison is git log --since='2016-05-06' --pretty=format:"%h %an %cd" --graph --first-parent. Looking at the git log documentation the --first-parent option is described as:

Follow only the first parent commit upon seeing a merge commit. This option can give a better overview when viewing the evolution of a particular topic branch, because merges into a topic branch tend to be only about adjusting to updated upstream from time to time, and this option allows you to ignore the individual commits brought in to your history by such a merge.

In their reply GitHub share what one of their developers said about the GitHub Desktop Comparison Graph

"GitHub Desktop is optimized for GitHub Flow. In this model, merges almost always represent either (1) a branch getting merged into the default branch via a pull request or (2) a branch being updated from the default branch.

In the first case, it's most useful to see which pull requests have been merged—not the individual commits that make up that pull request. We think pull requests are amazing and very useful for understanding history, so we want to prioritize them.

In the second case, seeing the commits that came in with a merge only obscures the changes on the branch. It's most useful to see the commits that are unique to the branch."

But the goal is that "in the future [they] would like to make all commits reachable in GitHub Desktop"