Difference in Git merge order?

git

Solution

The end result in terms of the file content should be the same in all cases you described.

But there will be a difference in the DAG, in the ordering of commits in the graph of all commits, for example:

Case 1: `git merge c1 c2`

*   dd24250 (HEAD, master) Merge branches 'c1' and 'c2'
|\  
| * 9d09bec (c2) change in c2
* | 1f5c0ca (c1) change in c1
|/  

Case 2: `git merge c2 c1`

*   3256c8d (HEAD, master) Merge branches 'c2' and 'c1'
|\  
| * 1f5c0ca (c1) change in c1
* | 9d09bec (c2) change in c2
|/  

Case 3: `git checkout c1; git merge c2`

*   111e7da (HEAD, c1) Merge branch 'c2' into c1
|\  
| * 9d09bec (c2) change in c2
* | 1f5c0ca change in c1
|/  

Case 4: `git checkout c2; git merge c1`

*   8ccf531 (HEAD, c2) Merge branch 'c1' into c2
|\  
| * 1f5c0ca (c1) change in c1
* | 9d09bec change in c2
|/  

Problem

Is there any difference between ``` git merge c1 c2 ``` and ``` git merge c2 c1 ``` ? Also, is there any difference between ``` git checkout c1 git merge c2 ``` and ``` git checkout c2 git merge c1 ``` ?

Original source

Related problems