Why does git (sometimes) clone a merge commit?

I know that there are some scenarios that lead to a duplication of the Git, for example git cherry-pick. If the commit is selected by cherries and merged into another branch, it appears twice in the commit column with two commit hashes.

Is it possible that Git duplicates a commit during an operation git merge?

The reason I ask is the following commit graph (generated in TortoiseGit):

enter image description here

Commits are listed here in a "date-order" (author date).

After I put efb916..in the green branch (which was my branch master), I merged the green branch into the red branch (which is the local branch). This appears as a regular merge on the chart. So far so good.

Github Windows, master origin/master. commit 09067c.. , master, commit 09067c.. commit efb916... efb916.. 09067c.., Git commit efb916.. 48e314...

master 48e314.. ( ), 68b78a.. ( ). , , efb916.. 48e314.. .

, , .

Git commit efb916..? ?

EDIT: : , master efb916.., , Github Sync efb916.. master.

+4
4

. , shas. , .

"pull" . , , .

- ,

git pull --rebase

pull rebase ( , )

git config pull.rebase true

, ,

branch.<branch>.rebase true 
+2

, . , . .

, , . - , . , , ( ) , , , .

: , . , , , . , :

:

# echo "a" >> file
# git init
Initialized empty Git repository in /home/hardaker/tmp/h/test/.git/
# (master #): git add file
# (master #): git commit -m "new file"
[master (root-commit) 9617f27] new file
 1 file changed, 1 insertion(+)
 create mode 100644 file

:

# (master): git checkout -b new-branch
Switched to a new branch 'new-branch'

:

# (new-branch): echo "file2" > file2
# (new-branch): git add file2 
P# (new-branch +): git commit -m "new file2" file2 
[new-branch 04f3fdf] new file2
 1 file changed, 1 insertion(+)
 create mode 100644 file2

:

# (new-branch): git checkout master
Switched to branch 'master'
# (master): echo "b" >> file 
# (master *): git commit -m "added b" -a
[master 3b3de88] added b
 1 file changed, 1 insertion(+)

, :

# (master):  git log --oneline --graph --all --decorate
* 3b3de88 (HEAD, master) added b
| * 04f3fdf (new-branch) new file2
|/  
* 9617f27 new file

. new-branch, , :

# (master): git checkout new-branch 
Switched to branch 'new-branch'
# (new-branch): git rebase master
 file | 1 +
 1 file changed, 1 insertion(+)
First, rewinding head to replay your work on top of it...
Applying: new file2

, .

# (new-branch):  git log --oneline --graph --all --decorate
* d9918d4 (HEAD, new-branch) new file2
* 3b3de88 (master) added b
* 9617f27 new file

, , , , , Git . .

+3

git merge , ()

git rebase.

git .

git rebase git cherry-pick, , git rebase git cherry-pick - , !, , ,

+1
source

Found in the Github settings for Windows:

enter image description here

0
source

All Articles