﻿<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="ja">
	<id>https://wiki.blender.jp/index.php?action=history&amp;feed=atom&amp;title=Dev%3ADoc%2FTools%2FPatches</id>
	<title>Dev:Doc/Tools/Patches - 版の履歴</title>
	<link rel="self" type="application/atom+xml" href="https://wiki.blender.jp/index.php?action=history&amp;feed=atom&amp;title=Dev%3ADoc%2FTools%2FPatches"/>
	<link rel="alternate" type="text/html" href="https://wiki.blender.jp/index.php?title=Dev:Doc/Tools/Patches&amp;action=history"/>
	<updated>2026-06-13T20:55:45Z</updated>
	<subtitle>このウィキのこのページに関する変更履歴</subtitle>
	<generator>MediaWiki 1.31.0</generator>
	<entry>
		<id>https://wiki.blender.jp/index.php?title=Dev:Doc/Tools/Patches&amp;diff=51748&amp;oldid=prev</id>
		<title>Yamyam: 1版 をインポートしました</title>
		<link rel="alternate" type="text/html" href="https://wiki.blender.jp/index.php?title=Dev:Doc/Tools/Patches&amp;diff=51748&amp;oldid=prev"/>
		<updated>2018-06-28T17:49:55Z</updated>

		<summary type="html">&lt;p&gt;1版 をインポートしました&lt;/p&gt;
&lt;table class=&quot;diff diff-contentalign-left&quot; data-mw=&quot;interface&quot;&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;ja&quot;&gt;
				&lt;td colspan=&quot;1&quot; style=&quot;background-color: #fff; color: #222; text-align: center;&quot;&gt;← 古い版&lt;/td&gt;
				&lt;td colspan=&quot;1&quot; style=&quot;background-color: #fff; color: #222; text-align: center;&quot;&gt;2018年6月28日 (木) 17:49時点における版&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-notice&quot; lang=&quot;ja&quot;&gt;&lt;div class=&quot;mw-diff-empty&quot;&gt;(相違点なし)&lt;/div&gt;
&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;</summary>
		<author><name>Yamyam</name></author>
		
	</entry>
	<entry>
		<id>https://wiki.blender.jp/index.php?title=Dev:Doc/Tools/Patches&amp;diff=51747&amp;oldid=prev</id>
		<title>2018年5月13日 (日) 12:48にwiki&gt;Mont29による</title>
		<link rel="alternate" type="text/html" href="https://wiki.blender.jp/index.php?title=Dev:Doc/Tools/Patches&amp;diff=51747&amp;oldid=prev"/>
		<updated>2018-05-13T12:48:44Z</updated>

		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;新規ページ&lt;/b&gt;&lt;/p&gt;&lt;div&gt;=Patches and Diffs=&lt;br /&gt;
&lt;br /&gt;
==What is a patch?==&lt;br /&gt;
A patch is no more than a text file which contains data about the differences between two versions of code. They contain changes to code, adding functionality, fixing a bug, etc. A patch contains information about which files change on which lines and how. [[Dev:Doc/Process/Contributing_Code|Contributing Code to Blender]] is done through such ''patches'' or ''diffs''.&lt;br /&gt;
&lt;br /&gt;
The words ''patch'' and ''diff'' are often used interchangeably, although for Git they can mean slight different things. Our Code Review tool currently accepts diffs created with &amp;lt;tt&amp;gt;git diff&amp;lt;/tt&amp;gt; or &amp;lt;tt&amp;gt;git show&amp;lt;/tt&amp;gt;, not &amp;lt;tt&amp;gt;git format-patch&amp;lt;/tt&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
====When should I submit a patch?====&lt;br /&gt;
Writing patches is generally done for two reasons:&lt;br /&gt;
&lt;br /&gt;
* '''To distribute a bugfix''': often you may spot a bug in Blender's source code before a developer has the opportunity to do the same work. Creating a patch is the perfect opportunity to get the work done without putting it on someone else's (likely very long) todo list.&lt;br /&gt;
&lt;br /&gt;
* '''Contributing new features''': many coders take it upon themselves to add functionality to Blender in their own free time. Without these 'homebrew' projects, Blender would not be what it is today. Outside contributions from hobbyists and professionals alike are crucial to the development process. Yes that means you!&lt;br /&gt;
&lt;br /&gt;
==Applying Patches==&lt;br /&gt;
&lt;br /&gt;
In order to apply the changes stored in a patch file to your checkout of the source code you need to use the following command in your repository root directory. Note: the following require that patch is installed.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
# for git diffs&lt;br /&gt;
patch -p1 &amp;lt; some-new-feature.diff&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
# for svn diffs (older patches in the tracker)&lt;br /&gt;
patch -p0 &amp;lt; some-new-feature.diff&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You will then be given an indication of whether or not the operation was a success. If it was not, there are many possibilities as to why your source code was incompatible with the source code the patch was created against. It is best to contact the author to be sure you both have an updated version of sources or edit the resulting files manually to be sure everything is as it should be. Be warned! This can be a time consuming and frustrating process.&lt;br /&gt;
&lt;br /&gt;
==Reverting Patches==&lt;br /&gt;
&lt;br /&gt;
You can revert the changes made by a patch by using the -R switch as shown below, again from the root directory:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
# for git diffs&lt;br /&gt;
patch -p1 -R &amp;lt; some-new-feature.diff&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
# for svn diffs (older patches in the tracker)&lt;br /&gt;
patch -p0 -R &amp;lt; some-new-feature.diff&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Creating Patches==&lt;br /&gt;
&lt;br /&gt;
The simplest way is simply to make changes in the code, then run this command from the root repository directory. You can then upload this file and share it with others.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
git diff &amp;gt; some-new-feature.diff&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Creating Patches from Local Git Branches==&lt;br /&gt;
&lt;br /&gt;
When working with Git, the usual workflow is to create local branches where you commit your changes. You can then easily switch between the unmodified master branch and your local branch, and create a diff from the local branch when you're ready to submit it.&lt;br /&gt;
&lt;br /&gt;
To create a new branch when you are in the &amp;lt;tt&amp;gt;master&amp;lt;/tt&amp;gt; branch, the basic commands are:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
git checkout -b some-new-feature&lt;br /&gt;
# ... make changes to code ...&lt;br /&gt;
git commit -a&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To generate a diff, you can run:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
# generate a diff&lt;br /&gt;
git diff master..some-new-feature &amp;gt; some-new-feature.diff&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you work on your &amp;lt;tt&amp;gt;some-new-feature&amp;lt;/tt&amp;gt; branch but do not submit its diff soon, it can get out of sync with the &amp;lt;tt&amp;gt;master&amp;lt;/tt&amp;gt; branch, where you typically keep pulling in commits with new features and bugfixes from the main repository. If you are going to do further work on the new feature or send a diff, you want it to be created relative to the very latest version of the main repository. Otherwise your diff may no longer apply cleanly for others, or your feature may no longer work correctly due to changes in the code.&lt;br /&gt;
&lt;br /&gt;
To get all those new commits into your &amp;lt;tt&amp;gt;some-new-feature&amp;lt;/tt&amp;gt; branch as well, you have to 'rebase' it on top of &amp;lt;tt&amp;gt;master&amp;lt;/tt&amp;gt;. That means it will pull in new commits from &amp;lt;tt&amp;gt;master&amp;lt;/tt&amp;gt; and keep your local commits at the top of the commit list.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
# switch to feature branch&lt;br /&gt;
git checkout some-new-feature&lt;br /&gt;
# rebase on top of master&lt;br /&gt;
git rebase master&lt;br /&gt;
# now you can continue work on the feature or generate a new diff&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For more info on how to use Git or how to submit changes for code review, see the [[Dev:Doc/Tools/Git|Git Usage]] and [[Dev:Doc/Tools/Code_Review|Code Review]] pages.&lt;br /&gt;
&lt;br /&gt;
==Git Mailbox Style Patch Sets==&lt;br /&gt;
&lt;br /&gt;
With Git you can create more advanced patches that can contain multiple commits and information about the author. Unfortunately our code review tool does not accept these yet, for that you have to use the &amp;lt;tt&amp;gt;arc&amp;lt;/tt&amp;gt; command line tool described on the code review documentation.&lt;br /&gt;
&lt;br /&gt;
For reference, here is how to use such patches. To apply:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
# for git mailbox style patch sets&lt;br /&gt;
git am group-of-patches.mbx&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To create patches in mailbox style format from changes in a branch:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
git format-patch --stdout origin &amp;gt; group-of-patches.mbx&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To generate a mailbox style patch from commits R1 to R2:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
git format-patch --stdout R1..R2 &amp;gt; group-of-patches.mbx&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;/div&gt;</summary>
		<author><name>wiki&gt;Mont29</name></author>
		
	</entry>
</feed>