git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
* How do I see “merge events” in history?
@ 2017-05-23 12:07 Stefan Monov
  2017-05-23 12:20 ` Jeff King
  0 siblings, 1 reply; 2+ messages in thread
From: Stefan Monov @ 2017-05-23 12:07 UTC (permalink / raw)
  To: Git mailing list

I use the GitHub web interface and the git cli. Answers for either or
both are appreciated.

Sometimes, when I merge a branch into another branch, I see a commit
with a message like "Merge branch 'master' into other_branch" in the
GitHub history. But not always. So how do I see all "merge events",
inside the history?

Even better if I can get a view with vertical lines showing branches
and merges (like a graph).

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: How do I see “merge events” in history?
  2017-05-23 12:07 How do I see “merge events” in history? Stefan Monov
@ 2017-05-23 12:20 ` Jeff King
  0 siblings, 0 replies; 2+ messages in thread
From: Jeff King @ 2017-05-23 12:20 UTC (permalink / raw)
  To: Stefan Monov; +Cc: Git mailing list

On Tue, May 23, 2017 at 03:07:40PM +0300, Stefan Monov wrote:

> I use the GitHub web interface and the git cli. Answers for either or
> both are appreciated.
> 
> Sometimes, when I merge a branch into another branch, I see a commit
> with a message like "Merge branch 'master' into other_branch" in the
> GitHub history. But not always. So how do I see all "merge events",
> inside the history?

The simple answer is that to see all merges, you can run "git log
--merges". But I think that's not quite what you're asking.

Your "but not always" makes me think you are wondering why sometimes
when you run "git merge" (or "git pull), it results in a merge commit
and sometimes not, and whether you can see evidence of the times when it
was "not".

When a merge is a "fast forward", i.e., when the thing you are merging
is strictly a descendent of your current branch, then Git omits the
merge commit and simply updates your current branch tip to the thing
you're merging. This can happen if you forked a branch, and then when it
came time to merge it back, nothing had happened on the original branch.

In a fast forward merge, there's no evidence at all of the merge command
in the resulting history graph. So there's nothing to find via "git
log".

For some workflows you'd rather see a commit for such merges, even if it
could fast-forward. For example, when merging a topic branch, you may
want the graph to reflect that the work was done on a side branch, even
if nothing happened on "master" in the interim. You can use "git merge
--no-ff" for this.

> Even better if I can get a view with vertical lines showing branches
> and merges (like a graph).

Try "git log --oneline --decorate --graph". It will show you the graph
structure and annotate the tips of any branches.

-Peff

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2017-05-23 12:20 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-05-23 12:07 How do I see “merge events” in history? Stefan Monov
2017-05-23 12:20 ` Jeff King

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