<?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 Time Friend</title><link>https://time-friend.com/en/tags/git/</link><description>Recent content in Git on Time Friend</description><generator>Hugo</generator><language>en-GB</language><lastBuildDate>Wed, 29 Jul 2026 15:15:07 +0800</lastBuildDate><atom:link href="https://time-friend.com/en/tags/git/index.xml" rel="self" type="application/rss+xml"/><item><title>A Bug Caused by .gitattributes File from Two Years Ago</title><link>https://time-friend.com/en/archive/gitattributes-bug-from-two-years-ago/</link><pubDate>Thu, 24 Jan 2019 19:33:33 +0000</pubDate><guid>https://time-friend.com/en/archive/gitattributes-bug-from-two-years-ago/</guid><description>&lt;h1 id="cause"&gt;Cause&lt;/h1&gt;
&lt;p&gt;On a whim, I opened a frontend project I wrote two years ago to start code review.
I wrote this project alone for two years, roughly over a hundred thousand lines of code.&lt;/p&gt;
&lt;p&gt;Found that Git in this project recognized all code files as binary files.
This problem had troubled me for a long time, but I couldn&amp;rsquo;t find the cause. This led to my code having no diff history.&lt;/p&gt;</description></item><item><title>Git Case-Insensitive Causing Annoying Problem</title><link>https://time-friend.com/en/archive/git-case-insensitive-issue/</link><pubDate>Wed, 09 Jan 2019 19:33:33 +0000</pubDate><guid>https://time-friend.com/en/archive/git-case-insensitive-issue/</guid><description>&lt;blockquote&gt;
&lt;p&gt;Because a colleague changed a folder name from lowercase to uppercase, I couldn&amp;rsquo;t directly push, rebase and other operations locally. Very annoying~&lt;/p&gt;
&lt;/blockquote&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;error: The following untracked working tree files would be overwritten by checkout:
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; xxx.js
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;Please move or remove them before you can switch branches.
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;Aborting
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h1 id="solution"&gt;Solution&lt;/h1&gt;
&lt;p&gt;Set to case-sensitive (must restore configuration after problem is solved)&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;git config core.ignorecase false
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Although setting case-sensitive will always affect code in other branches, so it&amp;rsquo;s not recommended to use this configuration permanently. After the problem is solved, it should be changed back.&lt;/p&gt;</description></item><item><title>Git Delete All Commit History Solution</title><link>https://time-friend.com/en/archive/git-delete-all-commits-solution/</link><pubDate>Tue, 30 Oct 2018 19:33:33 +0000</pubDate><guid>https://time-friend.com/en/archive/git-delete-all-commits-solution/</guid><description>&lt;p&gt;If your previous project committed some sensitive data, or you want to clear previous commit history, here&amp;rsquo;s the solution.&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#75715e"&gt;# 1. Check out a new branch&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;git checkout --orphan latest_branch
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#75715e"&gt;# 2. Stage all files&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;git add -A
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#75715e"&gt;# 3. Commit the staged files&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;git commit -am &lt;span style="color:#e6db74"&gt;&amp;#34;commit message&amp;#34;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#75715e"&gt;# 4. Delete the original branch&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;git branch -D master
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#75715e"&gt;# 5. Rename the current branch&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;git branch -m master
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#75715e"&gt;# 6. Push your history to the remote repository&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;git push -f origin master
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;</description></item><item><title>Git Push Stuck Solution</title><link>https://time-friend.com/en/archive/git-push-stuck-solution/</link><pubDate>Mon, 09 Apr 2018 19:33:33 +0000</pubDate><guid>https://time-friend.com/en/archive/git-push-stuck-solution/</guid><description>&lt;p&gt;The blog&amp;rsquo;s daily English is directly scraped from Shanbay English. To avoid directly requesting proxy interfaces (which would be relatively slow).
So my program generates corresponding data files every day, and the frontend directly gets them via ajax.
Blog content is also automatically published every day, achieving the effect of updating famous quotes and sentences daily.
Haven&amp;rsquo;t checked for a long time, found many git commits weren&amp;rsquo;t pushed. After manually pushing, found there were over 800 modifications not pushed.&lt;/p&gt;</description></item><item><title>Git Series - About the Add Command</title><link>https://time-friend.com/en/archive/git-series-about-add-command/</link><pubDate>Sun, 10 Sep 2017 19:33:33 +0000</pubDate><guid>https://time-friend.com/en/archive/git-series-about-add-command/</guid><description>&lt;h2 id="basic-usage"&gt;Basic Usage&lt;/h2&gt;
&lt;p&gt;Usually add &lt;code&gt;&amp;lt;path&amp;gt;&lt;/code&gt; to the index library through the form &lt;code&gt;git add &amp;lt;path&amp;gt;&lt;/code&gt;,&lt;/p&gt;
&lt;p&gt;&lt;code&gt;&amp;lt;path&amp;gt;&lt;/code&gt; can be a file or a directory:&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;git add &amp;lt;path&amp;gt;
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;If there are many changes, you can use the following command to add all changed files at once:&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt; git add -A .
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Add all modifications to the staging area, including new files and edited files, excluding deleted files:&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;$ git add . 
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Means add all content:&lt;/p&gt;</description></item></channel></rss>