News for hackers. Stuff that matters.
Re:Git Branches: Intuition and Reality by paulddraper on Thursday November 23, 2023 @11:20AM (#38394400)
Merging branch A into branch B does two things:

1. Create a new merge commit with two parents: the commit pointed to by A and the commit pointed to by B.

2. Set branch B to point at the new merge commit.

This is a non-linear history; when comparing some commits there isn't a "before" or "after."

Re:Git Branches: Intuition and Reality by hackernews1134 on Thursday November 23, 2023 @07:02PM (#38399233)
If I checkout the merge commit and then do a ‘git log -n 5’, which parent pointer is followed to show the previous commit logs? A or B or Both / all if it is more than a 2-way merge?
Re:Git Branches: Intuition and Reality by baronswindle on Thursday November 23, 2023 @07:32PM (#38399459)
As I recall, it shows commits from both parents in order of the committed date.
Re:Git Branches: Intuition and Reality by paulddraper on Thursday November 23, 2023 @09:07PM (#38400007)
By default it's by commit date.

Other ordering is possible, e.g. --topo-order

Re:Git Branches: Intuition and Reality by emilecantin on Thursday November 23, 2023 @11:12PM (#38400583)
To complete the answer, the only difference if you merge branch B into branch A is that A is advanced to the new commit instead.