Skip to content

wataash/git-test-github-merge

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 

Repository files navigation

There is also 日本語 translation.

Understanding GitHub merge

Consider creating a pull request, which merge the branch named pull-request into master branch.

image

This commit graph is generated by tig command (tig master pull-request). (On Windows, I recommend Sourcetree to generate commit graphs.)

When merging the pull request, there are three options:

After merging, the commit graphs will be look like these:

Create a merge commit

image

Squash and merge

image

Note that the commit authors (charles and donald) have been replaced with the merger (wataash). git show --pretty=full squash-and-merge:

commit decb2967fed0c8bf776055abdeeb70db5c4680e3 (origin/squash-and-merge, squash-and-merge)
Author: Wataru Ashihara <wataash@users.noreply.github.com>
Commit: GitHub <noreply@github.com>

    Try "Squash and merge" (#2)
    
    * commit C
    
    * commit D

diff --git a/c.txt b/c.txt
new file mode 100644
index 0000000..e69de29
diff --git a/d.txt b/d.txt
new file mode 100644
index 0000000..e69de29

When merging by "Squash and merge", the author will be the merger and the committer will be "GitHub". Personally I don't prefer "Squash and merge" since the contributions, which can be seen in "Insights", seems to be lost. If you want to squash commits, I recommend using git rebase --interactive

Rebase and merge

image

Though the authors are not changed, the committer are changed to GitHub Name <account@users.noreply.github.com>. git log --pretty=full -2 rebase-and-merge:

commit 24c02be4250587e26ded87f84ba157414593f35f (origin/rebase-and-merge, rebase-and-merge)
Author: Donald Dijkstra <donald@example.com>
Commit: Wataru Ashihara <wataash@users.noreply.github.com>

    commit D

commit 6fa84589a2af5f3234d647a097046f4e7847c420
Author: Charles Codd <charles@example.com>
Commit: Wataru Ashihara <wataash@users.noreply.github.com>

    commit C

Miscellaneous

To get grasp of the commit-graph status, always use a visualizing tool (tig --all Sourcetree, SmartGit or so on).

About

Understanding GitHub merging

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published