Skip to Content
Linux in a Nutshell, 6th Edition
book

Linux in a Nutshell, 6th Edition

by Ellen Siever, Stephen Figgins, Robert Love, Arnold Robbins
September 2009
Beginner
942 pages
85h 34m
English
O'Reilly Media, Inc.
Content preview from Linux in a Nutshell, 6th Edition

Name

merge

Synopsis

git merge commit ...

Merge one or more other branches into the current HEAD. For each specified commit, Git calculates the set of changes on that branch that are not currently in HEAD and attempts to apply those changes to the current HEAD. If the changes cannot be applied successfully, Git will leave conflicts in the index, which you will need to resolve by hand (using an editor, git add, and git commit).

Almost always, you will supply exactly one commit. In some situations, you may wish to merge more than one branch at the same time; this is called an octopus merge and is allowed only if none of the merges cause any conflicts. It is equivalent to merging the given commits one by one, except that the merged result produces only one new commit.

You can override the merge strategy to be used, but this is almost never necessary. When more than one commit is specified, the only allowed strategy is octopus.

Normally, Git combines the branch histories so git log will show all the commits from all branches that have been merged. With --squash, it eliminates the history of the branches other than HEAD. This simplifies the git log output, but prevents successful merges from that branch in the future, so it is usually a bad idea.

Options

--no-commit
--squash
--log
--no-ff
-s (resolve|recursive|octopus|ours|subtree)
-m msg

Examples

To merge feature branches feature1 and feature2 into your current branch using an octopus merge:

$ git merge feature1 feature2 Already up-to-date with aa871d4ef9657e03b2ef7053dc13a16777955499 ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Unix in a Nutshell, 4th Edition

Unix in a Nutshell, 4th Edition

Arnold Robbins
Linux Under the Hood

Linux Under the Hood

Sander van Vugt
Linux Kernel in a Nutshell

Linux Kernel in a Nutshell

Greg Kroah-Hartman

Publisher Resources

ISBN: 9780596806088Errata Page