Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
git_merge [2019/03/07 13:49] – [Per-branch merge options] rpjdaygit_merge [2019/03/13 13:09] (current) – [Global merge.ff option] rpjday
Line 333: Line 333:
 </code> </code>
  
-For example, if you wanted to prevent any fast-forward merges to any ''master'' branch, you could:+For example, if you wanted to prevent any fast-forward merges to any ''master'' branch across all of your repositories, you could:
  
 <code> <code>
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 ''man git-merge''):
  
 <code> <code>
Line 356: Line 356:
 </code> </code>
  
-So:+So for widespread fast-forward merge configuration:
  
 <code> <code>
Line 362: Line 362:
 </code> </code>
  
-This setting is superseded by any per-branch setting.+This setting is superseded by any per-branch fast-forward merge setting. 
 + 
 +===== Merge strategies ===== 
 + 
 +==== ours ==== 
 + 
 +Technically record a merge while totally ignoring its content -- for record-keeping. 
 + 
 +Example: 
 + 
 +<code> 
 +$ git checkout master 
 +$ git merge --strategy=ours <obsolete branch> 
 +</code> 
 + 
 +How to make ''master'' look exactly like ''develop'': 
 + 
 +<code> 
 +$ git checkout topic 
 +$ git merge -s ours master 
 +$ git checkout master 
 +$ git merge --ff-only topic 
 +</code> 
 + 
 +To do this for an arbitrary commit, create a temporary branch: 
 + 
 +<code> 
 +$ git checkout -b tempbranch <commit ID> 
 +$ git merge -s ours master 
 +$ git checkout master 
 +$ git merge --ff-only tempbranch 
 +</code>
  • git_merge.1551966589.txt.gz
  • Last modified: 2019/03/07 13:49
  • by rpjday