<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
  <channel>
    <title>Git on Ken Huang</title>
    <link>https://blog.kenhuang.io/tags/git/</link>
    <description>Recent content in Git on Ken Huang</description>
    <generator>Hugo</generator>
    <language>en</language>
    <managingEditor>whatacold@gmail.com (Ken Huang)</managingEditor>
    <webMaster>whatacold@gmail.com (Ken Huang)</webMaster>
    <lastBuildDate>Fri, 17 Oct 2025 20:27:26 +0800</lastBuildDate>
    <atom:link href="https://blog.kenhuang.io/tags/git/rss.xml" rel="self" type="application/rss+xml" />
    <item>
      <title>The Binary Search Idea for Narrowing Down Problem Space</title>
      <link>https://blog.kenhuang.io/blog/2020-02-04-binary-search-algorithm-vs-problem-solving/</link>
      <pubDate>Tue, 04 Feb 2020 18:48:00 +0800</pubDate><author>whatacold@gmail.com (Ken Huang)</author>
      <guid>https://blog.kenhuang.io/blog/2020-02-04-binary-search-algorithm-vs-problem-solving/</guid>
      <description>&lt;p&gt;&#xA;&lt;a href=&#34;https://en.wikipedia.org/wiki/Binary_search_algorithm&#34;&gt;Binary search algorithm&lt;/a&gt; is a search algorithm that finds the position of a target value within a sorted array. It cuts off the target array in half in a pass, so that it has a worst-case performance of &lt;code class=&#34;verbatim&#34;&gt;O(log n)&lt;/code&gt;.&lt;/p&gt;&#xA;&lt;figure&gt;&#xA;&lt;img src=&#34;https://upload.wikimedia.org/wikipedia/commons/8/83/Binary_Search_Depiction.svg&#34; alt=&#34;https://upload.wikimedia.org/wikipedia/commons/8/83/Binary_Search_Depiction.svg&#34; title=&#34;https://upload.wikimedia.org/wikipedia/commons/8/83/Binary_Search_Depiction.svg&#34; /&gt;&lt;figcaption&gt;&#xA;Visualization of the binary search algorithm where 7 is the target value(@wikipedia)&#xA;&lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&lt;p&gt;&#xA;We all know that it&amp;#39;s an efficient searching algorithm, but the strategy behind it also applies for narrowing down other problem space, for example, finding out when a bug is first introduced in a series of git commits.&lt;/p&gt;</description>
    </item>
    <item>
      <title>Why Can&#39;t Git Fetch Remote Branches Other Than Master?</title>
      <link>https://blog.kenhuang.io/blog/2019-12-01-why-cant-git-fetch-remote-branches-other-than-master/</link>
      <pubDate>Sun, 01 Dec 2019 16:00:00 +0800</pubDate><author>whatacold@gmail.com (Ken Huang)</author>
      <guid>https://blog.kenhuang.io/blog/2019-12-01-why-cant-git-fetch-remote-branches-other-than-master/</guid>
      <description>&lt;p&gt;&#xA;Last week I came into a problem with Git, that I can&amp;#39;t fetch the remote branch that I just pushed to. It was so weird because I can push it. It never happens before, and it happened when I was in a rush to rebase my code, as someone in my team pushed his code.&lt;/p&gt;&#xA;&lt;p&gt;&#xA;After searching, it seemed that the configuration of &lt;code class=&#34;verbatim&#34;&gt;fetch&lt;/code&gt; of that repo was different(this &lt;a href=&#34;https://stackoverflow.com/questions/11623862/fetch-in-git-doesnt-get-all-branches&#34;&gt;Stack Overflow&lt;/a&gt; thread for example) than before, it was specified that only &lt;code class=&#34;verbatim&#34;&gt;master&lt;/code&gt; can be fetched. It worked after I changed it to &lt;code class=&#34;verbatim&#34;&gt;+refs/heads/*:refs/remotes/origin/*&lt;/code&gt;.&lt;/p&gt;</description>
    </item>
    <item>
      <title>How To Revert a Series of Git Commits?</title>
      <link>https://blog.kenhuang.io/blog/2019-09-24-how-to-revert-a-series-of-commits-with-git/</link>
      <pubDate>Tue, 24 Sep 2019 23:14:00 +0800</pubDate><author>whatacold@gmail.com (Ken Huang)</author>
      <guid>https://blog.kenhuang.io/blog/2019-09-24-how-to-revert-a-series-of-commits-with-git/</guid>
      <description>&lt;p&gt;&#xA;Sometimes, I need to revert a series of commits that I&amp;#39;ve already pushed, doing a git hard &lt;a href=&#34;https://git-scm.com/docs/git-reset&#34;&gt;reset&lt;/a&gt; (&lt;code class=&#34;verbatim&#34;&gt;git reset --hard&lt;/code&gt;) is not an option, as someone may already have new commits based on mine.&lt;/p&gt;&#xA;&lt;p&gt;&#xA;For example, assume that I&amp;#39;ve made a few commits like below:&lt;/p&gt;&#xA;&lt;pre class=&#34;example&#34;&gt;&#xA;65a2c62 * commit 10&#xA;25cad43 * commit 9&#xA;72ad583 * commit 8&#xA;ceebf9a * commit 7&#xA;acf8a11 * commit 6&#xA;28d526f * commit 5&#xA;63af1e2 * commit 4&#xA;982c71c * commit 3&#xA;0fb4c2d * commit 2&#xA;acf9da1 * commit 1&#xA;b5f9933 * commit 0&#xA;&lt;/pre&gt;&#xA;&lt;p&gt;&#xA;For whatever reason, I need to &amp;#34;drop&amp;#34; the changes made by commit 6 to commit 10, that is, go back to &amp;#34;commit 5&amp;#34; without deleting these commits.&lt;/p&gt;</description>
    </item>
  </channel>
</rss>
