Differences
This shows you the differences between two versions of the page.
| Both sides previous revision Previous revision Next revision | Previous revision | ||
| git_merge [2019/03/07 13:50] – [Per-branch merge options] rpjday | git_merge [2019/03/13 13:09] (current) – [Global merge.ff option] rpjday | ||
|---|---|---|---|
| Line 333: | Line 333: | ||
| </ | </ | ||
| - | For example, if you wanted to prevent any fast-forward merges to any '' | + | For example, if you wanted to prevent any fast-forward merges to any '' |
| < | < | ||
| Line 341: | Line 341: | ||
| ==== Global merge.ff option ==== | ==== Global merge.ff option ==== | ||
| - | For merging, there is at least one repo-wide merge option you can set: | + | For merging, there is at least one repo-wide merge option you can set (see '' |
| < | < | ||
| Line 356: | Line 356: | ||
| </ | </ | ||
| - | So: | + | So for widespread fast-forward merge configuration: |
| < | < | ||
| Line 362: | Line 362: | ||
| </ | </ | ||
| - | This setting is superseded by any per-branch setting. | + | This setting is superseded by any per-branch |
| + | |||
| + | ===== Merge strategies ===== | ||
| + | |||
| + | ==== ours ==== | ||
| + | |||
| + | Technically record a merge while totally ignoring its content -- for record-keeping. | ||
| + | |||
| + | Example: | ||
| + | |||
| + | < | ||
| + | $ git checkout master | ||
| + | $ git merge --strategy=ours < | ||
| + | </ | ||
| + | |||
| + | How to make '' | ||
| + | |||
| + | < | ||
| + | $ git checkout topic | ||
| + | $ git merge -s ours master | ||
| + | $ git checkout master | ||
| + | $ git merge --ff-only topic | ||
| + | </ | ||
| + | |||
| + | To do this for an arbitrary commit, create a temporary branch: | ||
| + | |||
| + | < | ||
| + | $ git checkout -b tempbranch <commit ID> | ||
| + | $ git merge -s ours master | ||
| + | $ git checkout master | ||
| + | $ git merge --ff-only tempbranch | ||
| + | </ | ||