git-nullmerge - Find and merge a commit with a tree that matches an ancestor exactly.
git nullmerge [OPTIONS] <commit>
When a branch has undergone extensive history rewriting, attempting to merge it
can result in many false and unnecessary merge conflicts. If such history
rewriting has preserved the entire tree at some points along the history, a
so-called null merge can be justified. git-nullmerge can automatically find
the correct point in history and create a null merge. The message will include a
justification with an overview of the relavant part of the commit graph.
Technically, git nullmerge will:
- Find the latest commit
THEIRsuch thatTHEIRis in<commit>THEIRis not inOUR(whereOURisHEADat start of execution)- There exists a commit
IDENTICALsuch thatIDENTICALis inOURIDENTICALis not inTHEIRIDENTICALandTHEIRpoint to identical trees.
- Make a merge commit with
OURandTHEIRas parents and with a tree identical toOUR. - Optionally update
HEADto point to the newly created merge commit.
Place git-nullmerge somewhere in your $PATH.
Suppose a remote repository has altered all commit messages, and also diverged.
It will then appear like an unrelated history, and git merge will refuse to
merge it.
* (remote) E
* C'
* B'
* A'
* (HEAD) D
* C
* B
* A
Using git nullmerge remote, the actual fork point will be identified and
merged:
* (remote) E
* | (HEAD) Null merge
|\|
| * C'
| * B'
| * A'
* D
* C
* B
* A
After this, git merge can do a correct merge.
* (HEAD) Merge
|\
| * (remote) E
* | Null merge
|\|
* | D
| * C'
| * B'
| * A'
* C
* B
* A
git replace: Replace objects in the git graph at the interpretation level.
git-reparent: Create a commit with the same tree but different parents.