<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
  <channel>
    <title>Cli on Datengraben</title>
    <link>https://datengraben.com/tags/cli/</link>
    <description>Recent content in Cli on Datengraben</description>
    <generator>Hugoo -- gohugo.io</generator>
    <language>de-DE</language><atom:link href="https://datengraben.com/tags/cli/rss.xml" rel="self" type="application/rss+xml" />
    <item>
      <title>Manually merging git commits</title>
      <link>https://datengraben.com/til/manual-git-merge/</link>
      <pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate>
      
      
      <guid>https://datengraben.com/til/manual-git-merge/</guid>
      <description>&lt;p&gt;Today I learned how to manually merge a git branch, when you want to be sure to compare each difference after a merge.&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;Don&amp;rsquo;t fast-forward and commit when merging:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;background-color:#f0f0f0;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;git merge --no-ff --no-commit feature-branch
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Now changes are applied and staged. Because we want to inspect each difference, we remove all changes from the staging area:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;background-color:#f0f0f0;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;git restore --staged .
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Changes are now only applied, but not staged. So we can now easily inspect each change (via cli or IDE) and remove all changes we don&amp;rsquo;t want to keep.&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;git add --patch -- . # to add changes to the staging area
git checkout --patch -- . # to fully remove applied changes
&lt;/code&gt;&lt;/pre&gt;&lt;/li&gt;
&lt;/ol&gt;</description>
    </item>
    
  </channel>
</rss>
