<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Muhammed B. Dincer on Medium]]></title>
        <description><![CDATA[Stories by Muhammed B. Dincer on Medium]]></description>
        <link>https://medium.com/@bthndncr23?source=rss-90dabccea733------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*tFffmn23IOpc83XT.jpg</url>
            <title>Stories by Muhammed B. Dincer on Medium</title>
            <link>https://medium.com/@bthndncr23?source=rss-90dabccea733------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Wed, 02 Dec 2026 09:41:30 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@bthndncr23/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Master your Git Skills #2]]></title>
            <link>https://medium.com/@bthndncr23/master-your-git-skills-2-729a973eef06?source=rss-90dabccea733------2</link>
            <guid isPermaLink="false">https://medium.com/p/729a973eef06</guid>
            <category><![CDATA[software-development]]></category>
            <category><![CDATA[technology]]></category>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[github]]></category>
            <category><![CDATA[git]]></category>
            <dc:creator><![CDATA[Muhammed B. Dincer]]></dc:creator>
            <pubDate>Fri, 10 Jul 2020 17:32:00 GMT</pubDate>
            <atom:updated>2020-07-10T19:22:12.687Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/338/1*pyz5f0-rniilEI2xq6CIBw.jpeg" /><figcaption><a href="https://www.pikist.com/free-photo-ifhlt">pikist.com</a></figcaption></figure><p>In this article, we will continue to take a look at more git-based scenarios and common questions that’s been raised among the developers most of the time.</p><p>If you missed the first article, you can check it out <a href="https://medium.com/@bthndncr23/master-your-git-skills-1-77aa1d386ed7">Master your Git Skills #1</a></p><ol><li><strong>I accidentally committed and pushed a merge</strong></li></ol><p>If you accidentally merged a feature branch into the main development branch before it was ready to be merged, you can still undo the merge.</p><p>First, you need to find the commit id of the merge commit;</p><pre>$ git log</pre><p>Capture the id of the merge commit. Then;</p><pre>$ git revert -m 1 &lt;id of the merge commit&gt;</pre><p>Where the -m 1 option says to select the parent number 1(first parent of the merge commit)</p><p><strong>2. I want to discard specific unstaged files</strong></p><p>When you want to get rid of one specific file in your working branch;</p><pre>$ git checkout &lt;myFile&gt;</pre><p>If you want to discard multiple files in your working branch, you can simply list them all;</p><pre>$ git checkout &lt;myFile&gt; &lt;otherFile&gt;</pre><p>When you want to get rid of all of your unstaged uncommitted changes;</p><pre>$ git checkout .</pre><p><strong>3. I want to create a branch from a specific commit</strong></p><p>You can simply use this command to create a branch form a commit that you want;</p><pre>$ git checkout -b &lt;branch-name&gt; &lt;SHA-OF-COMMIT&gt;</pre><p>-b option here says, create a branch and checkout to the newly created branch.</p><p><strong>4. I have made several commits on a branch that should be on different separate branches</strong></p><p>Alright, this will be a little longer so stay with me. Let’s say you’re on develop branch and made several commits that should be on different branches.</p><p>First, use git log to see your commits;</p><pre>(develop) $ git log</pre><pre>commit 734713bc047d87bf7eac9674765ae793478c50d3<br>Author: Muhammed Dincer&lt;m.dincer@gmail.com&gt;<br>Date:   Tue June 2 18:32:33 2020 -0800</pre><pre>     Bug #2 - fixed spacing</pre><pre>commit 1c002dd4b536e7479fe34593e72e6c6c1819e53b<br>Author: Muhammed Dincer&lt;m.dincer@gmail.com&gt;<br>Date:   Mon June 1 20:58:32 2020 -0800</pre><pre>     Bug #1 - updated endpoint</pre><pre>commit a11bef06a3f659402fe7563abf99ad00de2209e6<br>Author: Muhammed Dincer&lt;m.dincer@gmail.com&gt;<br>Date:   Mon June 1 19:35:10 2020 -0800</pre><pre>     First commit</pre><p>Take note of your commit hashes for each bug(734713bc for Bug #2, 1c002dd4 for Bug #1). Then, reset your develop branch to the starting commit(a11bef06);</p><pre>(develop) $ git reset --hard a11bef06</pre><p>HEADof develop branch is at a11bef06 . Now you can create a new branch for our first bug (Bug #1)</p><pre>(develop) $ git checkout -b bugfix/1<br>(bugfix/1) $</pre><p>Let’s cherry-pick the commit for Bug #1(1c002dd4) on top of our new branch. This will apply that commit on top of the branch.</p><pre>(bugfix/1) $ git cherry-pick 1c002dd4</pre><p>You might have some conflicts, so just resolve it.</p><p>Follow the same steps for Bug #2(734713bc);</p><pre>(develop) $ git checkout -b bugfix/2<br>(bugfix/2) $ git cherry-pick 734713bc</pre><p>Finally, you have 2 separate branches with the commits for each of your bugs.</p><p><strong>5. There are conflicts, what do I do?</strong></p><p>Well, I think this is the most common issue we as developers face. Here is a simple way to resolve the conflict.</p><p>Check which files have conflicts in them;</p><pre>$ git status<br>On branch my-branch<br>You have unmerged paths.<br>(fix conflicts and run &quot;git commit&quot;)<br>(use &quot;git merge --abort&quot; to abort the merge)<br><br>Unmerged paths:<br>(use &quot;git add &lt;file&gt;...&quot; to mark resolution)<br><br>both modified:   merge.txt</pre><p>This example merge.txt has conflicts. Open that file;</p><pre>&lt;&lt;&lt;&lt;&lt;&lt;&lt; HEAD<br>some code<br>=======<br>some other code<br>&gt;&gt;&gt;&gt;&gt;&gt;&gt; new commit</pre><p>You can keep one branch’s version of the code. You can either use --our or --theirs;</p><pre>$ git checkout --ours merge.txt</pre><p>If things are really complicated, then use a visual approach.</p><p>After you resolved all conflicts;</p><pre>$ git add merge.txt<br>$ git rebase --continue</pre><p>If you want to stop the rebase and go back to the original state of your branch, you can use git rebase — abort. You’re all set!</p><p><a href="https://medium.com/@bthndncr23/master-your-git-skills-1-77aa1d386ed7">Master your Git skills #1</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=729a973eef06" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Master your Git skills #1]]></title>
            <link>https://medium.com/@bthndncr23/master-your-git-skills-1-77aa1d386ed7?source=rss-90dabccea733------2</link>
            <guid isPermaLink="false">https://medium.com/p/77aa1d386ed7</guid>
            <category><![CDATA[git]]></category>
            <category><![CDATA[github]]></category>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[software-development]]></category>
            <category><![CDATA[technology]]></category>
            <dc:creator><![CDATA[Muhammed B. Dincer]]></dc:creator>
            <pubDate>Fri, 03 Jul 2020 18:34:11 GMT</pubDate>
            <atom:updated>2020-07-10T17:52:29.333Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*myFzqQvQ5bgBkqDf8Od4HA.jpeg" /><figcaption>Rainbow highway via <a href="http://www.allwallpaper.in/">www.allwallpaper.in</a></figcaption></figure><p>In this article, I am going to show you how to overcome git-based struggles that you probably need to google or stackoverflow it every time you stuck in a process of git.</p><p>We will go scenario by scenario. At the end of this article, you will be having a pretty good understanding of when/where to use what/which git commands.</p><p>If you don’t know Git fundamentals, <a href="https://git-scm.com/docs/git#_git_commands"><em>click here</em></a> to check out the documentation.</p><ol><li><strong>I set the wrong remote repository</strong></li></ol><p>If you cloned the wrong repository, simply delete the directory created after running git clone and clone the correct repository.</p><p>If you set the wrong repository as the origin of an existing local repository, change the url of your origin by running;</p><pre>$ git remote set-url origin &lt;url of the actual repo&gt;</pre><p><strong>2. I wrote the wrong thing in my commit message</strong></p><p>If you made a mistake in your commit message and the commit has not been yet published, you can do the following to change the commit message.</p><p>This will open your text editor where you can edit the message.</p><pre>$ git commit --amend —-only</pre><p>or</p><p>You can do this all in one command.</p><pre>$ git commit --amend --only -m “new commit message”</pre><p><strong>3. I want to delete or remove my last commit</strong></p><p>If you need to delete pushed commits, you can use the following;</p><p>*<em>Use this command carefully because it might mess up the history of anyone else who had already pulled from the repository</em></p><pre>$ git reset HEAD^ --hard<br>$ git push --force-with-lease &lt;remote-branch&gt;</pre><p>--force-with-lease is a safer option that will not overwrite any work on the <strong>remote branch</strong> if more commits were added to the <strong>remote branch.</strong></p><p>If you haven’t pushed your code, in order to reset Git to the state it was in before you made the last commit(while keeping your staged changes);</p><pre>(my-branch)$ git reset --soft HEAD@{1}</pre><p><strong>4. I accidentally did a hard reset, and I want my changes back</strong></p><p>If you accidentally do git reset --hard , you can still get your commit back, as git keeps a log of everything for a couple of days.</p><p><em>*This is only valid if your work is committed or stashed.</em> git reset --hard <em>will remove uncommitted modifications, so use it with caution. The safer option is</em> git reset --keep</p><p>This will show you a list of your past commits, and a commit for the reset;</p><pre>(master)$ git reflog</pre><p>Choose the SHA of the commit you want to return to, and reset again;</p><pre>(master)$ git reset --hard SHA1234</pre><p>You’re good to go!</p><p>Congrats! You learned how to deal with the most common and tricky git commands. I will publish new articles every week to cover all Git scenarios that most of the developers face. That’s the plan!</p><p><a href="https://medium.com/@bthndncr23/master-your-git-skills-2-729a973eef06">Master your Git skills #2</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=77aa1d386ed7" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>