<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Git / Source Control &#8211; XtremeOwnage</title>
	<atom:link href="https://xtremeownage.com/category/technology/software-development/git-source-control/feed/" rel="self" type="application/rss+xml" />
	<link>https://xtremeownage.com</link>
	<description>Cars, Computers, and Code.</description>
	<lastBuildDate>Sun, 08 Jan 2023 02:09:04 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.4.3</generator>

<image>
	<url>https://xtremeownage.com/wp-content/uploads/2019/09/cropped-Turbo-512-2-100x100.png</url>
	<title>Git / Source Control &#8211; XtremeOwnage</title>
	<link>https://xtremeownage.com</link>
	<width>32</width>
	<height>32</height>
</image> 
	<item>
		<title>Visual Studio / Git &#8211; Moving commits to another branch via Cherry-Pick</title>
		<link>https://xtremeownage.com/2019/10/29/visual-studio-git-moving-commits-to-another-branch-via-cherry-pick/</link>
		
		<dc:creator><![CDATA[XO]]></dc:creator>
		<pubDate>Tue, 29 Oct 2019 19:28:42 +0000</pubDate>
				<category><![CDATA[Git / Source Control]]></category>
		<category><![CDATA[Software Development]]></category>
		<guid isPermaLink="false">https://xtremeownage.com/?p=735</guid>

					<description><![CDATA[Accidentally write code on the master branch, and need to move it to another branch? How to Cherry-pick your commits to another branch.]]></description>
										<content:encoded><![CDATA[
<p>Ever have the problem where you were not paying attention, and you created a few commits on the MASTER branch, instead of a feature branch? </p>



<p>No worries- I just made that exact same mistake, and I am going to demonstrate how to resolve the issue&#8230;.</p>



<p>In the below image, you can see&#8230;. I accidentally made my commits to the master branch, instead of my feature/dev/test branch. Instead of redoing all of the commits manually, I am going to demonstrate the cherry-pick method for manually moving the commits over.</p>



<figure class="wp-block-image"><a href="https://xtremeownage.com/wp-content/uploads/2019/10/1.-Oops.png" rel="prettyPhoto[gallery-XkEU]"><img fetchpriority="high" decoding="async" width="420" height="468" src="https://xtremeownage.com/wp-content/uploads/2019/10/1.-Oops.png" alt="" class="wp-image-737" srcset="https://xtremeownage.com/wp-content/uploads/2019/10/1.-Oops.png 420w, https://xtremeownage.com/wp-content/uploads/2019/10/1.-Oops-269x300.png 269w" sizes="(max-width: 420px) 100vw, 420px" /></a><figcaption>Uh-oh, I accidentally commited my changes to master&#8230;.</figcaption></figure>



<h2 class="wp-block-heading">Method: Cherry Pick Commits to new branch</h2>



<p>For method one, I will demonstrate cherry-picking the specific commits, into the proper branch.</p>



<h4 class="wp-block-heading">Step 1: Take note of the specific commits.</h4>



<p>In my example, I need to move these commits:</p>



<ul><li>dda291d4 &#8211; Update LIB.Interfaces</li><li>d46a4441 &#8211; The lastExecutionIdParameter&#8230;.</li></ul>



<p>I am leaving out the &#8220;merge branch &#8216;master'&#8221;commit, because, the new branch is already up to date with master.</p>



<h4 class="wp-block-heading">Step 2: Create new branch, or switch to the proper branch.</h4>



<figure class="wp-block-image"><a href="https://xtremeownage.com/wp-content/uploads/2019/10/2.-Create-New-Branch-or-Select-Proper-Branch.png" rel="prettyPhoto[gallery-XkEU]"><img decoding="async" width="449" height="611" src="https://xtremeownage.com/wp-content/uploads/2019/10/2.-Create-New-Branch-or-Select-Proper-Branch.png" alt="" class="wp-image-738" srcset="https://xtremeownage.com/wp-content/uploads/2019/10/2.-Create-New-Branch-or-Select-Proper-Branch.png 449w, https://xtremeownage.com/wp-content/uploads/2019/10/2.-Create-New-Branch-or-Select-Proper-Branch-220x300.png 220w" sizes="(max-width: 449px) 100vw, 449px" /></a><figcaption>Create a new branch, or select the proper branch.</figcaption></figure>



<h4 class="wp-block-heading">Step 3. Cherry pick the individual commits</h4>



<p>While this functionality is likely built into visual studio somewhere, I chose the command line terminal to perform the cherry-pick.</p>



<p>If you do not have git in your path variable, you may use the visual studio Nuget package manager console to perform these changes.</p>



<figure class="wp-block-image"><a href="https://xtremeownage.com/wp-content/uploads/2019/10/3.-Cherry-Pick-Commits.png" rel="prettyPhoto[gallery-XkEU]"><img decoding="async" width="979" height="511" src="https://xtremeownage.com/wp-content/uploads/2019/10/3.-Cherry-Pick-Commits.png" alt="" class="wp-image-739" srcset="https://xtremeownage.com/wp-content/uploads/2019/10/3.-Cherry-Pick-Commits.png 979w, https://xtremeownage.com/wp-content/uploads/2019/10/3.-Cherry-Pick-Commits-300x157.png 300w, https://xtremeownage.com/wp-content/uploads/2019/10/3.-Cherry-Pick-Commits-768x401.png 768w" sizes="(max-width: 979px) 100vw, 979px" /></a><figcaption>git cherry pick command</figcaption></figure>



<h4 class="wp-block-heading">Done!</h4>



<figure class="wp-block-image"><a href="https://xtremeownage.com/wp-content/uploads/2019/10/4.-Done.png" rel="prettyPhoto[gallery-XkEU]"><img loading="lazy" decoding="async" width="414" height="356" src="https://xtremeownage.com/wp-content/uploads/2019/10/4.-Done.png" alt="" class="wp-image-740" srcset="https://xtremeownage.com/wp-content/uploads/2019/10/4.-Done.png 414w, https://xtremeownage.com/wp-content/uploads/2019/10/4.-Done-300x258.png 300w" sizes="(max-width: 414px) 100vw, 414px" /></a><figcaption>Voila- commits are now on the proper branch.</figcaption></figure>



<p>After cherry-picking the individual commits to the new branch, you are done!</p>



<p>Make sure to rebuild with the updated code, to ensure you didn&#8217;t leave something out.</p>
]]></content:encoded>
					
		
		
			</item>
	</channel>
</rss>
