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
docs:git:creating_and_applying_patch_files [2010/09/20 16:28] billhdocs:git:creating_and_applying_patch_files [2014/09/29 17:09] (current) – [applying a patch file (method 2)] billh
Line 7: Line 7:
 </code> </code>
  
-===== applying a patch file ===== +===== applying a patch file (method 1) ===== 
-First create a new branch:+Make sure you are on a clean working copy, then apply the patch to the working copy (no commits are added, only working copy files are updated): 
 +<code> 
 +git apply their-patch-file.diff 
 +</code> 
 + 
 +Now you can review the changes as necessary. 
 + 
 +Note that the above method is a git patch file, suitable for using git am.  This is not the same as a standard patch file created with diff.  Git patch files contain author's, commit messages and metadata, etc... 
 + 
 +===== applying a patch file (method 2) ===== 
 +This will add consecutive commits to your current branch, including the commit messages.  At the end of the patch, your working copy should be clean with a history of all applied commits.  First create a new branch:
 <code> <code>
 git checkout -b new-branch-name git checkout -b new-branch-name
  • docs/git/creating_and_applying_patch_files.1285021699.txt.gz
  • Last modified: 2010/09/20 16:28
  • by billh