<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Naveen Niraula</title>
    <description>The latest articles on DEV Community by Naveen Niraula (@xyznaveen).</description>
    <link>https://dev.to/xyznaveen</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F423190%2Fc2c1c70b-8066-4d36-9a69-653458090f42.jpeg</url>
      <title>DEV Community: Naveen Niraula</title>
      <link>https://dev.to/xyznaveen</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/xyznaveen"/>
    <language>en</language>
    <item>
      <title>Consequences of for-Git-ting to merge the master into feature branch!</title>
      <dc:creator>Naveen Niraula</dc:creator>
      <pubDate>Tue, 13 Aug 2024 11:35:10 +0000</pubDate>
      <link>https://dev.to/xyznaveen/consequences-of-for-git-ting-to-merge-the-master-into-feature-branch-4d2g</link>
      <guid>https://dev.to/xyznaveen/consequences-of-for-git-ting-to-merge-the-master-into-feature-branch-4d2g</guid>
      <description>&lt;p&gt;First off, pardon my not so punny title.&lt;/p&gt;

&lt;p&gt;Second, let's start by clarifying this isn't a &lt;strong&gt;guide&lt;/strong&gt; or a &lt;strong&gt;how to&lt;/strong&gt;. It's just how I unf*cked my situation (that I created) just before a release. &lt;/p&gt;

&lt;p&gt;I understand this might not be the best possible way. But let's just assume it is for my situation (any inputs are welcome, for my future F ups.&lt;/p&gt;

&lt;p&gt;Context:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;My PR got reviewed and was ready to be shipped.&lt;/li&gt;
&lt;li&gt;Next, I see changes in master ( main, whatever ); saw conflicts in my branch (didn't merge it, OOOPS 0!)&lt;/li&gt;
&lt;li&gt;Changed files in my branch; commit -&amp;gt; pushed (OOOPS 1!)&lt;/li&gt;
&lt;li&gt;Merge master (conflicts in the same files and lines that I pushed, resolved it without thinking what the changes were on master, OOOPS 2!) &lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;(In the above stage I assumed that master would adjust and separate to my changes from itself, OOOPS 3!)&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;PR got updated, but now as you guessed it was in abnormal state where master's changes were overwritten by mine)&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Enter: Panic mode&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;After 1 hour of discussion of what should be done, I decided to soft reset it ~2 commits.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;UNF*CKING Process&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;First, I reverted the commits that caused the issue using &lt;code&gt;git reset --soft HEAD~2&lt;/code&gt;. Great, now what ?&lt;/p&gt;

&lt;p&gt;Tried to &lt;code&gt;git push&lt;/code&gt; current state; git rejected caused well I effed up.&lt;/p&gt;

&lt;p&gt;I did what a normal person (in a mental asylum) would do. &lt;/p&gt;

&lt;p&gt;&lt;code&gt;git push --force&lt;/code&gt; (TADA), everything's good.&lt;/p&gt;

&lt;p&gt;It worked because I was the only PERSON working on that branch. I do not recommend the &lt;code&gt;--force&lt;/code&gt; in any situation but well I don't really know any alternative.&lt;/p&gt;

&lt;p&gt;Now, the wizards on dev.to please enlighten me if that was the correct approach. Or it should've been something else.&lt;/p&gt;

</description>
      <category>git</category>
      <category>commit</category>
      <category>productivity</category>
      <category>programming</category>
    </item>
  </channel>
</rss>
