<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
    <channel>
        <title>Daily Mark</title>
        <description>Today's mark</description>
        <link>https://mr.mk</link>
        <atom:link href="https://mr.mk/feed.xml" rel="self" type="application/rss+xml" />
        
            <item>
                <title>第一篇文章 欢迎来到 Daily Mark</title>
                <description>&lt;h2 id=&quot;你好-&quot;&gt;你好 👋&lt;/h2&gt;

&lt;p&gt;这里是 &lt;strong&gt;Daily Mark&lt;/strong&gt;，记录每一天的思考与发现。&lt;/p&gt;

&lt;p&gt;博客正在建设中，敬请期待…&lt;/p&gt;
</description>
                <pubDate>Tue, 28 Jul 2026 00:00:00 +0800</pubDate>
                <link>https://mr.mk/2026/07/28/welcome/</link>
                <guid isPermaLink="true">https://mr.mk/2026/07/28/welcome/</guid>
            </item>
        
            <item>
                <title>Notes on ECMAScript 2015 Language Specification</title>
                <description>&lt;p&gt;This is the note taken when reading &lt;a href=&quot;http://www.ecma-international.org/ecma-262/6.0/index.html&quot; target=&quot;_blank&quot;&gt;ECMA-262 edition 6&lt;/a&gt;.&lt;/p&gt;

&lt;h1 id=&quot;section-4&quot;&gt;Section 4&lt;/h1&gt;

&lt;blockquote&gt;
  &lt;p&gt;ECMAScript is an &lt;strong&gt;object-oriented&lt;/strong&gt; programming language for performing computations and manipulating computational objects within a host environment.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;blockquote&gt;
  &lt;p&gt;ECMAScript is &lt;strong&gt;object-based&lt;/strong&gt;: basic language and host facilities are provided by objects, and an ECMAScript program is a cluster of communicating objects.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;blockquote&gt;
  &lt;p&gt;An &lt;em&gt;ordinary object&lt;/em&gt; is object that has the default behaviour for the essential internal methods that must be supported by all objects. An &lt;em&gt;exotic object&lt;/em&gt; is object that does not have the default behaviour for one or more of the essential internal methods that must be supported by all objects. Any object that is not an ordinary object is an exotic object.&lt;/p&gt;
&lt;/blockquote&gt;
</description>
                <pubDate>Sun, 26 Jul 2015 00:00:00 +0800</pubDate>
                <link>https://mr.mk/notes/note/2015/07/26/notes-on-ecmascript-2015-language-specification/</link>
                <guid isPermaLink="true">https://mr.mk/notes/note/2015/07/26/notes-on-ecmascript-2015-language-specification/</guid>
            </item>
        
            <item>
                <title>我所犯过的错误们 惩毖录</title>
                <description>&lt;p&gt;我记性很差。我总是忘记犯过的错误，然后再犯。&lt;/p&gt;

&lt;p&gt;一而再也就算了，但我不想再而三。&lt;/p&gt;

&lt;p&gt;所以我写下这篇&lt;a href=&quot;https://mr.mk/notes/&quot;&gt;笔记&lt;/a&gt;，一则警戒犯过的错误，二则为再遇到同样的问题提提供帮助，三则日后看到曾经犯过的愚蠢错误也值得一笑。大多数错误的原因是比较简单的，否则将单独作为博客来写。&lt;/p&gt;

&lt;h1 id=&quot;threejs&quot;&gt;Three.js&lt;/h1&gt;

&lt;h2 id=&quot;照相机&quot;&gt;照相机&lt;/h2&gt;

&lt;h3 id=&quot;20150609记错参数顺序&quot;&gt;2015.06.09：记错参数顺序&lt;/h3&gt;

&lt;p&gt;正交投影构造函数是&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;THREE.OrthographicCamera(left, right, top, bottom, near, far)&lt;/code&gt;，我把&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;top&lt;/code&gt;和&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;bottom&lt;/code&gt;的顺序记反了，因为&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;left&lt;/code&gt;是比&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;right&lt;/code&gt;小的，很自然地就以为&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;bottom&lt;/code&gt;在&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;top&lt;/code&gt;之前了。&lt;/p&gt;

&lt;p&gt;观察到的结果是，所有面片都显示不出来了。&lt;/p&gt;

&lt;p&gt;排查了一个小时，意识到这是因为照相机观察到的是面片的反面，所以给网格都设置了&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;side: THREE.BackSide&lt;/code&gt;，而没有意识到是照相机的问题。再之后贴图，发现上下颠倒了，回想以前把照相机放在&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;(0, 0, 5)&lt;/code&gt;这样的位置是不需要这是渲染反面的，最后怀疑是参数顺序的问题，查了一下果然如此。&lt;/p&gt;

&lt;h2 id=&quot;坐标系&quot;&gt;坐标系&lt;/h2&gt;

&lt;h3 id=&quot;20150614webgl-坐标系搞反了&quot;&gt;2015.06.14：WebGL 坐标系搞反了&lt;/h3&gt;

&lt;p&gt;将边缘检测功能从 Canvas 绘制修改成 WebGL 绘制时，发现三角面片的位置还是对的，但是取的颜色上下相反了。这是由于 WebGL 坐标系与屏幕坐标系的 Y 坐标是相反的，用 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;1 - y&lt;/code&gt; 表示 WebGL 下的坐标系。&lt;/p&gt;

&lt;p&gt;谨戒之。&lt;/p&gt;

&lt;h3 id=&quot;20150623再次把-webgl-视口坐标系搞反了&quot;&gt;2015.06.23：再次把 WebGL 视口坐标系搞反了！！！&lt;/h3&gt;

&lt;p&gt;我又犯了同样的错误！！！找了四五个小时都没找到原因！最后还是沈大侠一语道破！&lt;/p&gt;

&lt;p&gt;不想玩了啊！为什么我的记性这么差！！！&lt;/p&gt;

&lt;h1 id=&quot;crosswalk&quot;&gt;Crosswalk&lt;/h1&gt;

&lt;h2 id=&quot;android&quot;&gt;Android&lt;/h2&gt;

&lt;h3 id=&quot;20150623定位超时&quot;&gt;2015.06.23：定位超时&lt;/h3&gt;

&lt;p&gt;在 Crosswalk Embedded 模式下，用 JavaScript 对于 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;navigator.geolocation.getCurrentPosition&lt;/code&gt; 调用一直失败，测试代码在 &lt;a href=&quot;http://jsbin.com/pifas/2&quot; target=&quot;_blank&quot;&gt;http://jsbin.com/pifas/2&lt;/a&gt;。电脑上的 Chrome 能够正常获取位置，手机上的 QQ 浏览器能获取，但是嵌套在 Crosswalk 里就不行。&lt;/p&gt;

&lt;p&gt;最后发现是由于手机没开启 GPS。:joy:&lt;/p&gt;

&lt;p&gt;后来我又在手机的 Firefox 和 Chrome 试了一下，在关闭 GPS 开启 WiFi 的情况下，前者可以正常获得，后者显示“在 Android 设置部分开启位置信息服务。我怀疑这可能是 QQ 浏览器和 Firefox 根据 WiFi 的 IP 获得了粗略的位置信息。&lt;/p&gt;

&lt;h1 id=&quot;环境配置&quot;&gt;环境配置&lt;/h1&gt;

&lt;h2 id=&quot;jekyll&quot;&gt;Jekyll&lt;/h2&gt;

&lt;h3 id=&quot;20150615安装-jekyll-失败&quot;&gt;2015.06.15：安装 Jekyll 失败&lt;/h3&gt;

&lt;p&gt;运行 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;$ sudo gem install jekyll&lt;/code&gt; 的时候总是出现以下错误，怀疑是网络问题导致。&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-text&quot; data-lang=&quot;text&quot;&gt;ERROR:  Could not find a valid gem &apos;jekyll&apos; (&amp;gt;= 0), here is why:
Unable to download data from https://rubygems.org/ - Errno::ETIMEDOUT: Operation timed out - connect(2) (https://rubygems.org/latest_specs.4.8.gz)&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;结果更新了一下 gem 就好了：&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-bash&quot; data-lang=&quot;bash&quot;&gt;&lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;sudo &lt;/span&gt;gem update &lt;span class=&quot;nt&quot;&gt;--system&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;h2 id=&quot;pip-install&quot;&gt;pip install&lt;/h2&gt;

&lt;h3 id=&quot;20150806镜像设置报错&quot;&gt;2015.08.06：镜像设置报错&lt;/h3&gt;

&lt;p&gt;在安装 &lt;a href=&quot;http://scikit-image.org/download.html&quot;&gt;scikit-image&lt;/a&gt; 的时候，由于网络问题下载速度奇慢。按照网上设置代理的方式，一直报错。&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-bash&quot; data-lang=&quot;bash&quot;&gt;&lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;pip &lt;span class=&quot;nb&quot;&gt;install &lt;/span&gt;xxx &lt;span class=&quot;nt&quot;&gt;-i&lt;/span&gt; http://pypi.mirrors.ustc.edu.cn/simple/
The repository located at pypi.mirrors.ustc.edu.cn is not a trusted or secure host and is being ignored. If this repository is available via HTTPS it is recommended to use HTTPS instead, otherwise you may silence this warning and allow it anyways with &lt;span class=&quot;s1&quot;&gt;&apos;--trusted-host pypi.mirrors.ustc.edu.cn&apos;&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;.&lt;/span&gt;
Could not find a version that satisfies the requirement matplotlib &lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;from versions: &lt;span class=&quot;o&quot;&gt;)&lt;/span&gt;
No matching distribution found &lt;span class=&quot;k&quot;&gt;for &lt;/span&gt;matplotlib&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;正确的方法是：&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-bash&quot; data-lang=&quot;bash&quot;&gt;&lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;pip &lt;span class=&quot;nb&quot;&gt;install &lt;/span&gt;xxx &lt;span class=&quot;nt&quot;&gt;-i&lt;/span&gt; http://pypi.mirrors.ustc.edu.cn/simple/ &lt;span class=&quot;nt&quot;&gt;--trusted-host&lt;/span&gt; pypi.mirrors.ustc.edu.cn&lt;span class=&quot;s1&quot;&gt;&apos;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;速度快得感动 cry！:cry:&lt;/p&gt;

&lt;h1 id=&quot;杂项&quot;&gt;杂项&lt;/h1&gt;

&lt;h2 id=&quot;photoshop&quot;&gt;PhotoShop&lt;/h2&gt;

&lt;h3 id=&quot;20150728将-ps-源文件保存为后缀为-png-的图片&quot;&gt;2015.07.28：将 PS 源文件保存为后缀为 png 的图片&lt;/h3&gt;

&lt;p&gt;也不是第一次犯这个错误了，在 PS 中保存 png 图片的时候，经常忘记改图片类型而直接改了图片后缀。这就导致保存的实际是 PS 源文件，而后缀名却是 png。更坑爹的是，在 Mac 下预览完全没有问题（因为是按 PS 源文件预览的）！然后在 Three.js 里加载纹理，一直没显示出来，我还以为是 Three.js 的设置那里出了问题，没想到是图片本身！&lt;/p&gt;

&lt;p&gt;最后我是怎么发现问题的呢？我想会不会是 png 的图片有问题，想把它在 PS 里转成 jpeg 的，但是 PS 识别不出来！后来我想起来以前好像碰到过类似的情况，所以把后缀改成 psd 再在 PS 里打开。&lt;/p&gt;
</description>
                <pubDate>Tue, 09 Jun 2015 00:00:00 +0800</pubDate>
                <link>https://mr.mk/notes/note/2015/06/09/bug-list/</link>
                <guid isPermaLink="true">https://mr.mk/notes/note/2015/06/09/bug-list/</guid>
            </item>
        
            <item>
                <title>书里的人生信条</title>
                <description>&lt;h1 id=&quot;中庸&quot;&gt;中庸&lt;/h1&gt;

&lt;blockquote&gt;
  &lt;p&gt;人心惟危，道心惟微，惟精惟一，允执厥中。&lt;/p&gt;
&lt;/blockquote&gt;

&lt;blockquote&gt;
  &lt;p&gt;——《尚书·大禹谟》&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;我很喜欢儒家文化中这种战战兢兢、诚惶诚恐的感觉，或言之，敬畏。小心谨慎地保持着中正之道，就连只有自己知道的时候，也要“慎独”，不能把“道”丢了，要谨慎地一贯秉持着中庸之道。听起来就像是在说，&lt;em&gt;骗人的最高境界就是把自己也骗信了&lt;/em&gt;！或许这样的评价也不算过分，或许我就是把自己都骗得信了的吧，所以我才很喜欢这些道理。&lt;/p&gt;

&lt;blockquote&gt;
  &lt;p&gt;知者弗言，言者弗知。塞其兑，闭其门；挫其锐，解其纷；和其光，同其尘；是谓玄同。&lt;/p&gt;
&lt;/blockquote&gt;

&lt;blockquote&gt;
  &lt;p&gt;——《道德经》&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;金子都等着发光的一刻，殊不知那也是千百磨练的开始。不如藏之名山，传之其人。&lt;/p&gt;

&lt;blockquote&gt;
  &lt;p&gt;君子素其位而行，不愿乎其外。素富贵，行乎富贵；素贫贱，行乎贫贱；素夷狄，行乎夷狄；素患难，行乎患难：君子无入而不自得焉。在上位不陵下，在下位不援上，正己而不求于人，则无怨。上不怨天，下不尤人。故君子居易以俟命，小人行险以徼幸。&lt;/p&gt;
&lt;/blockquote&gt;

&lt;blockquote&gt;
  &lt;p&gt;——《中庸》&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;特别喜欢这句“君子素其位而行”，过怎样一种生活本身并没有优劣，只是应该顺势而行。&lt;/p&gt;

&lt;blockquote&gt;
  &lt;p&gt;士君子须是内精明而外浑厚。&lt;/p&gt;
&lt;/blockquote&gt;

&lt;blockquote&gt;
  &lt;p&gt;——《菜根谭》&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h1 id=&quot;仕与隐&quot;&gt;仕与隐&lt;/h1&gt;

&lt;blockquote&gt;
  &lt;p&gt;古之君子，不必仕，不必不仕。必仕则忘其身，必不仕则忘其君。譬之饮食，适于饥饱而已。然士罕能蹈其义、赴其节。处者安于故而难出，出者狃于利而忘返。于是有违亲绝俗之讥，怀禄苟安之弊。&lt;/p&gt;
&lt;/blockquote&gt;

&lt;blockquote&gt;
  &lt;p&gt;——苏轼《灵壁张氏园亭记》&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;我对苏轼倒谈不上特别的喜欢，但这句话我却是非常赞同的。追求太过的人显得太世俗，不追求的人显得太没有责任感。&lt;/p&gt;

&lt;blockquote&gt;
  &lt;p&gt;思入世而有为者，须先领得世外风光，否则无以脱垢浊之尘缘；&lt;br /&gt;
思出世而无染者，须先谙尽世中滋味，否则无以持空寂之后苦趣。&lt;/p&gt;
&lt;/blockquote&gt;

&lt;blockquote&gt;
  &lt;p&gt;——《菜根谭》&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;虽然觉得&lt;a href=&quot;https://mr.mk/2014/01/09/reviewing-cai-gen-tan/&quot;&gt;《菜根谭》格调不高&lt;/a&gt;，但这句话还是说的不错的。&lt;/p&gt;

&lt;h1 id=&quot;孤独&quot;&gt;孤独&lt;/h1&gt;

&lt;blockquote&gt;
  &lt;p&gt;大团圆的文化是让我们偶尔陶醉一下，以为自己找到了另一半，可是只要你清醒，你就知道个体的孤独性不可能被他者替代。但不要误会这就没有爱了，而是在个体独立的状态下，他的爱才会更成熟，不会是陶醉，也不会是倚赖。&lt;/p&gt;
&lt;/blockquote&gt;

&lt;blockquote&gt;
  &lt;p&gt;——《孤独六讲》&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h1 id=&quot;梦想&quot;&gt;梦想&lt;/h1&gt;

&lt;blockquote&gt;
  &lt;p&gt;为什么我们这样急于要成功，而从事这样荒唐的事业？如果一个人跟不上他的伴侣们，那也许是因为他听的是另一种鼓声。让他踏着他听到的音乐节拍而走路，不管那拍子如何，或者在多远的地方。&lt;/p&gt;
&lt;/blockquote&gt;

&lt;blockquote&gt;
  &lt;p&gt;——《瓦尔登湖》&lt;/p&gt;
&lt;/blockquote&gt;

&lt;blockquote&gt;
  &lt;p&gt;如果你因失去太阳而流泪，那么你也将失去群星。&lt;/p&gt;
&lt;/blockquote&gt;

&lt;blockquote&gt;
  &lt;p&gt;——《泰戈尔的诗》&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h1 id=&quot;女性&quot;&gt;女性&lt;/h1&gt;

&lt;blockquote&gt;
  &lt;p&gt;女人有女人的特别的聪明，轻盈活泼得跟她的举动一样。有了这种聪明，才学不过是沉淀渣滓。说女人有才学，就仿佛赞美一朵花，说它在天平上称起来有白菜番薯的斤两。真聪明的女人决不用功要做成才女，她只巧妙的偷懒。&lt;/p&gt;
&lt;/blockquote&gt;

&lt;blockquote&gt;
  &lt;p&gt;——《围城》&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;我喜欢这句话，或许是因为我是个懒人哈哈~ :joy:&lt;/p&gt;

&lt;blockquote&gt;
  &lt;p&gt;抽象的权利不足以限定女人的现实具体处境；这种处境在很大程度上取决于她的经济作用；而且，抽象的自由和具体的权力往往呈反比例变化。&lt;/p&gt;
&lt;/blockquote&gt;

&lt;blockquote&gt;
  &lt;p&gt;——《第二性》&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;简单地讲，我并不倾向于认为性别间应该完全平等，因为“平等”是一种不稳定的状态，就像天平平衡的时候略有外力就能改变平衡状态。劣势和优势在一定条件下是可以转换的，只是大多数人默默接受了劣势，或者在那边叫屈，而没有想过这是一种潜在的优势，或者说完全没有思路如何去将其变成优势。摸到一手不怎么好的牌还能赢得漂亮，这才是牌局精彩之处。而没有这些想法，即使拿到了一手好牌，也是打不好的。这时候，你当然可以怪命运，但生活还是你自己的。&lt;/p&gt;

&lt;h1 id=&quot;爱情&quot;&gt;爱情&lt;/h1&gt;

&lt;blockquote&gt;
  &lt;p&gt;曾经觉得不好喝的酒，或许是当时还没有到好的年份，或许是那时候还不懂得它的好。它就像你买了回来，随手翻了几页，觉得不好看，搁在一边的一本书。若干年后，你无意中再拿起来看，却“惊为天人”，恨自己当时错过了这么好的一本书。而其实，你并没有错过。这就像两个人的相遇，没有早一步，也没有迟一步，于茫茫的天地间，于无涯的时光里，就是这一刻。&lt;/p&gt;
&lt;/blockquote&gt;

&lt;blockquote&gt;
  &lt;p&gt;——《谢谢你离开我》&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h1 id=&quot;其他&quot;&gt;其他&lt;/h1&gt;

&lt;blockquote&gt;
  &lt;p&gt;正是一个人怎么看待自己，决定了此人的命运，指向了他的归宿。&lt;/p&gt;
&lt;/blockquote&gt;

&lt;blockquote&gt;
  &lt;p&gt;——《瓦尔登湖》&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;&lt;a href=&quot;https://mr.mk/2014/03/10/reviewing-walden/&quot;&gt;我非常向往瓦尔登湖那样的生活&lt;/a&gt;，但又自知难以放下。希望有一天可以实现。&lt;/p&gt;
</description>
                <pubDate>Sat, 18 Oct 2014 00:00:00 +0800</pubDate>
                <link>https://mr.mk/notes/note/2014/10/18/my-believes/</link>
                <guid isPermaLink="true">https://mr.mk/notes/note/2014/10/18/my-believes/</guid>
            </item>
        
            <item>
                <title>Frequently Used Commands of jQuery</title>
                <description>&lt;h1 id=&quot;scrolltop&quot;&gt;scrollTop&lt;/h1&gt;

&lt;h2 id=&quot;get-current-position-in-a-page&quot;&gt;Get Current Position in A Page&lt;/h2&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-js&quot; data-lang=&quot;js&quot;&gt;&lt;span class=&quot;nf&quot;&gt;$&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;window&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;).&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;scrollTop&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;();&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

</description>
                <pubDate>Wed, 15 Oct 2014 00:00:00 +0800</pubDate>
                <link>https://mr.mk/notes/note/2014/10/15/jquery/</link>
                <guid isPermaLink="true">https://mr.mk/notes/note/2014/10/15/jquery/</guid>
            </item>
        
            <item>
                <title>Frequently Used Commands of CSS</title>
                <description>&lt;h1 id=&quot;selector&quot;&gt;Selector&lt;/h1&gt;

&lt;h2 id=&quot;not&quot;&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;:not()&lt;/code&gt;&lt;/h2&gt;

&lt;h3 id=&quot;select-but-&quot;&gt;Select But …&lt;/h3&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-css&quot; data-lang=&quot;css&quot;&gt;&lt;span class=&quot;nd&quot;&gt;:not&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nc&quot;&gt;.some-class&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;h2 id=&quot;nth-child&quot;&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;:nth-child()&lt;/code&gt;&lt;/h2&gt;

&lt;h3 id=&quot;select-even-elements&quot;&gt;Select Even Elements&lt;/h3&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-css&quot; data-lang=&quot;css&quot;&gt;&lt;span class=&quot;nd&quot;&gt;:nth-child&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;even&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;E.g., set the background of even lines in tables to be different than that of odd ones.&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-css&quot; data-lang=&quot;css&quot;&gt;&lt;span class=&quot;nt&quot;&gt;tr&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;nl&quot;&gt;background-color&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;red&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;

&lt;span class=&quot;nt&quot;&gt;tr&lt;/span&gt;&lt;span class=&quot;nd&quot;&gt;:nth-child&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;even&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;nl&quot;&gt;background-color&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;green&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;h1 id=&quot;others&quot;&gt;Others&lt;/h1&gt;

&lt;h2 id=&quot;leading-zero&quot;&gt;Leading zero&lt;/h2&gt;

&lt;p&gt;To save the CSS file size, &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;0.5&lt;/code&gt; should be written without a leading zero as &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;.5&lt;/code&gt;.&lt;/p&gt;
</description>
                <pubDate>Sat, 11 Oct 2014 00:00:00 +0800</pubDate>
                <link>https://mr.mk/notes/note/2014/10/11/css/</link>
                <guid isPermaLink="true">https://mr.mk/notes/note/2014/10/11/css/</guid>
            </item>
        
            <item>
                <title>Frequently Used Commands of git</title>
                <description>&lt;blockquote&gt;
  &lt;p&gt;This post is about the git commands that I find hard to remember.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h1 id=&quot;git-add&quot;&gt;git add&lt;/h1&gt;

&lt;h2 id=&quot;add-tracked-files-only&quot;&gt;Add Tracked Files Only&lt;/h2&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-sh&quot; data-lang=&quot;sh&quot;&gt;&lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;git add &lt;span class=&quot;nt&quot;&gt;-u&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;h2 id=&quot;move-last-commits-to-a-new-branch&quot;&gt;Move Last Commits To A New Branch&lt;/h2&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-sh&quot; data-lang=&quot;sh&quot;&gt;&lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;git branch &amp;lt;branch_name&amp;gt;      &lt;span class=&quot;c&quot;&gt;# Create a new branch, saving the desired commits
&lt;/span&gt;
&lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;git reset &lt;span class=&quot;nt&quot;&gt;--hard&lt;/span&gt; HEAD~3       &lt;span class=&quot;c&quot;&gt;# Move master back by 3 commits (GONE from master)
&lt;/span&gt;
&lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;git checkout &amp;lt;branch_name&amp;gt;    &lt;span class=&quot;c&quot;&gt;# Go to the new branch that still has the desired commits&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;&lt;a href=&quot;https://stackoverflow.com/questions/1628563/move-the-most-recent-commits-to-a-new-branch-with-git&quot; target=&quot;_blank&quot;&gt;View on StackOverflow&lt;/a&gt;&lt;/p&gt;

&lt;h1 id=&quot;git-checkout&quot;&gt;git checkout&lt;/h1&gt;

&lt;h2 id=&quot;checkout-a-remote-branch&quot;&gt;Checkout A Remote Branch&lt;/h2&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-sh&quot; data-lang=&quot;sh&quot;&gt;&lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;git fetch
&lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;git checkout &amp;lt;branch_name&amp;gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;h2 id=&quot;discard-unstaged-changes&quot;&gt;Discard Unstaged Changes&lt;/h2&gt;

&lt;p&gt;Discard changes with new files:&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-sh&quot; data-lang=&quot;sh&quot;&gt;&lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;git clean &lt;span class=&quot;nt&quot;&gt;-df&lt;/span&gt;

&amp;lt;figure &lt;span class=&quot;nv&quot;&gt;class&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;highlight&quot;&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;gt;&lt;/span&gt;&amp;lt;pre&amp;gt;&amp;lt;code &lt;span class=&quot;nv&quot;&gt;class&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;language-sh&quot;&lt;/span&gt; data-lang&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;sh&quot;&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;gt;&lt;/span&gt;Discard changes with modified files:&amp;lt;/code&amp;gt;&amp;lt;/pre&amp;gt;&amp;lt;/figure&amp;gt;

&lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;git checkout &lt;span class=&quot;nt&quot;&gt;--&lt;/span&gt; .&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;&lt;a href=&quot;http://stackoverflow.com/questions/52704/how-do-you-discard-unstaged-changes-in-git#answer-12184274&quot; target=&quot;_blank&quot;&gt;View on StackOverflow&lt;/a&gt;&lt;/p&gt;

&lt;h1 id=&quot;git-clone&quot;&gt;git clone&lt;/h1&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-sh&quot; data-lang=&quot;sh&quot;&gt;&lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;git clone &lt;span class=&quot;nt&quot;&gt;--single-branch&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;--branch&lt;/span&gt; &amp;lt;branchname&amp;gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;h1 id=&quot;git-commit&quot;&gt;git commit&lt;/h1&gt;

&lt;h2 id=&quot;change-author-after-commit&quot;&gt;Change Author After Commit&lt;/h2&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-sh&quot; data-lang=&quot;sh&quot;&gt;&lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;git commit &lt;span class=&quot;nt&quot;&gt;--amend&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;--author&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;Wenli Zhang &amp;lt;zwl.sjtu@gmail.com&amp;gt;&quot;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;h2 id=&quot;reference-github-commit&quot;&gt;Reference GitHub Commit&lt;/h2&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-sh&quot; data-lang=&quot;sh&quot;&gt;&lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;git commit &lt;span class=&quot;nt&quot;&gt;-m&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;&apos;User/Project@&amp;lt;commit_hash&amp;gt;&apos;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;h1 id=&quot;git-config&quot;&gt;git config&lt;/h1&gt;

&lt;h2 id=&quot;prevent-github-git-bash-from-asking-for-password&quot;&gt;Prevent &lt;em&gt;GitHub&lt;/em&gt; git bash from Asking for Password&lt;/h2&gt;

&lt;p&gt;Change remote to be SSH instead of HTTPS.&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-sh&quot; data-lang=&quot;sh&quot;&gt;&lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;git config remote.origin.url git@github.com:&amp;lt;the_repository_username&amp;gt;/&amp;lt;your_project&amp;gt;.git&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;h2 id=&quot;colorful-ui&quot;&gt;Colorful UI&lt;/h2&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-sh&quot; data-lang=&quot;sh&quot;&gt;&lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;git config &lt;span class=&quot;nt&quot;&gt;--global&lt;/span&gt; color.ui auto&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;h2 id=&quot;alias&quot;&gt;Alias&lt;/h2&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-sh&quot; data-lang=&quot;sh&quot;&gt;git config &lt;span class=&quot;nt&quot;&gt;--global&lt;/span&gt; alias.ck checkout&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;So that I can use &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;git ck&lt;/code&gt; instead of &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;git checkout&lt;/code&gt; later.&lt;/p&gt;

&lt;h2 id=&quot;setup-email-and-name&quot;&gt;Setup email and name&lt;/h2&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-sh&quot; data-lang=&quot;sh&quot;&gt;git config &lt;span class=&quot;nt&quot;&gt;--global&lt;/span&gt; user.email &amp;lt;your_email&amp;gt;
git config &lt;span class=&quot;nt&quot;&gt;--global&lt;/span&gt; user.name &amp;lt;your_name&amp;gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;h1 id=&quot;git-diff&quot;&gt;git diff&lt;/h1&gt;

&lt;h2 id=&quot;view-changes-after-commit&quot;&gt;View Changes After Commit&lt;/h2&gt;

&lt;p&gt;Before committing, changes can be viewed by &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;git diff&lt;/code&gt;. But if you forget to check it before committing, this is what you can do.&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-sh&quot; data-lang=&quot;sh&quot;&gt;&lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;git log  &lt;span class=&quot;c&quot;&gt;# to get the last two commit hashes
&lt;/span&gt;
&lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;git diff &amp;lt;old-commit-hash&amp;gt; &amp;lt;new-commit-hash&amp;gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;h2 id=&quot;view-changes-of-a-commit&quot;&gt;View Changes of A Commit&lt;/h2&gt;

&lt;p&gt;To view the change of a specific commit, use&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-sh&quot; data-lang=&quot;sh&quot;&gt;&lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;git diff &lt;span class=&quot;nt&quot;&gt;--stat&lt;/span&gt; &amp;lt;commit-hash&amp;gt; &amp;lt;commit-hash&amp;gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;h2 id=&quot;view-changed-line-counts&quot;&gt;View Changed Line Counts&lt;/h2&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-sh&quot; data-lang=&quot;sh&quot;&gt;&lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;git diff &amp;lt;commit-hash&amp;gt;^!&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;h1 id=&quot;git-diff-tree&quot;&gt;git diff-tree&lt;/h1&gt;

&lt;h2 id=&quot;view-files-changed-in-a-commit&quot;&gt;View Files Changed in A Commit&lt;/h2&gt;

&lt;p&gt;To list the files changed in a commit, use&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-sh&quot; data-lang=&quot;sh&quot;&gt;&lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;git diff-tree &lt;span class=&quot;nt&quot;&gt;--no-commit-id&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;--name-only&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-r&lt;/span&gt; &amp;lt;commit-hash&amp;gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;h1 id=&quot;git-log&quot;&gt;git log&lt;/h1&gt;

&lt;h2 id=&quot;view-remote-commit-log&quot;&gt;View Remote Commit Log&lt;/h2&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-sh&quot; data-lang=&quot;sh&quot;&gt;&lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;git log &amp;lt;remote_name&amp;gt;/&amp;lt;branch_name&amp;gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;E.g., &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;git log origin/master&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;http://stackoverflow.com/questions/13941976/git-log-command-to-check-for-commit-history-on-remote-server&quot; target=&quot;_blank&quot;&gt;View on StackOverflow&lt;/a&gt;&lt;/p&gt;

&lt;h2 id=&quot;search-in-commit-log&quot;&gt;Search in Commit Log&lt;/h2&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-sh&quot; data-lang=&quot;sh&quot;&gt;&lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;git log &lt;span class=&quot;nt&quot;&gt;--all&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;--grep&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;&apos;aria&apos;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;h1 id=&quot;git-merge&quot;&gt;git merge&lt;/h1&gt;

&lt;h2 id=&quot;undo-unpushed-merge&quot;&gt;Undo unpushed merge&lt;/h2&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-sh&quot; data-lang=&quot;sh&quot;&gt;&lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;git merge &lt;span class=&quot;nt&quot;&gt;--abort&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;h2 id=&quot;merge-without-new-commit&quot;&gt;Merge without New Commit&lt;/h2&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-sh&quot; data-lang=&quot;sh&quot;&gt;git merge &amp;lt;branch_name&amp;gt; &lt;span class=&quot;nt&quot;&gt;--no-commit&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;--no-ff&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;h1 id=&quot;git-push&quot;&gt;git push&lt;/h1&gt;

&lt;h2 id=&quot;delete-a-remote-branch&quot;&gt;Delete A Remote Branch&lt;/h2&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-sh&quot; data-lang=&quot;sh&quot;&gt;&lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;git push origin &lt;span class=&quot;nt&quot;&gt;--delete&lt;/span&gt; &amp;lt;branch_name&amp;gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;h2 id=&quot;push-to-a-new-remote-branch&quot;&gt;Push To A New Remote Branch&lt;/h2&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-sh&quot; data-lang=&quot;sh&quot;&gt;&lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;git push origin &amp;lt;local_branch_name&amp;gt;:&amp;lt;remote_branch_name&amp;gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;h2 id=&quot;delete-a-remote-tag&quot;&gt;Delete A Remote Tag&lt;/h2&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-sh&quot; data-lang=&quot;sh&quot;&gt;&lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;git push origin :refs/tags/&amp;lt;tag_name&amp;gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;h1 id=&quot;git-remote&quot;&gt;git remote&lt;/h1&gt;

&lt;h2 id=&quot;add-remote&quot;&gt;Add Remote&lt;/h2&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-sh&quot; data-lang=&quot;sh&quot;&gt;&lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;git remote add origin https://github.com/USERNAME/OTHERREPOSITORY.git&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;h2 id=&quot;show-remote-url&quot;&gt;Show Remote URL&lt;/h2&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-sh&quot; data-lang=&quot;sh&quot;&gt;&lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;git remote show origin&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;h2 id=&quot;change-remote-url&quot;&gt;Change Remote URL&lt;/h2&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-sh&quot; data-lang=&quot;sh&quot;&gt;&lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;git remote set-url origin https://github.com/USERNAME/OTHERREPOSITORY.git&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;h1 id=&quot;git-reset&quot;&gt;git reset&lt;/h1&gt;

&lt;h2 id=&quot;undo-unpublished-commits&quot;&gt;Undo Unpublished Commits&lt;/h2&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-sh&quot; data-lang=&quot;sh&quot;&gt;&lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;git reset &lt;span class=&quot;nt&quot;&gt;--hard&lt;/span&gt; &amp;lt;hash_code_of_commit&amp;gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;h2 id=&quot;undo-published-commits&quot;&gt;Undo Published Commits&lt;/h2&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-sh&quot; data-lang=&quot;sh&quot;&gt;&lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;git reset &lt;span class=&quot;nt&quot;&gt;--hard&lt;/span&gt; &amp;lt;hash_code_of_commit&amp;gt;
git push &lt;span class=&quot;nt&quot;&gt;--force&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;h2 id=&quot;undo-a-commit&quot;&gt;Undo A Commit&lt;/h2&gt;

&lt;p&gt;After commit, to undo the commit, use:&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-sh&quot; data-lang=&quot;sh&quot;&gt;&lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;git reset &lt;span class=&quot;nt&quot;&gt;--soft&lt;/span&gt; HEAD~&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;h2 id=&quot;undo-uncommitted-changes&quot;&gt;Undo Uncommitted Changes&lt;/h2&gt;

&lt;p&gt;For tracked files and directories:&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-sh&quot; data-lang=&quot;sh&quot;&gt;&lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;git reset &lt;span class=&quot;nt&quot;&gt;--hard&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;For untracked files and directories:&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-sh&quot; data-lang=&quot;sh&quot;&gt;&lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;git clean &lt;span class=&quot;nt&quot;&gt;-fd&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;h2 id=&quot;revert-to-last-remote-commit&quot;&gt;Revert to Last Remote Commit&lt;/h2&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-sh&quot; data-lang=&quot;sh&quot;&gt;&lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;git reset &lt;span class=&quot;nt&quot;&gt;--hard&lt;/span&gt; origin/master&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;h1 id=&quot;git-revert&quot;&gt;git revert&lt;/h1&gt;

&lt;h2 id=&quot;revert-pushed-commit&quot;&gt;Revert Pushed Commit&lt;/h2&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-sh&quot; data-lang=&quot;sh&quot;&gt;&lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;git revert &amp;lt;hash_code_of_commit&amp;gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;h1 id=&quot;git-show&quot;&gt;git show&lt;/h1&gt;

&lt;h2 id=&quot;view-files-of-last-commit&quot;&gt;View Files of Last Commit&lt;/h2&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-sh&quot; data-lang=&quot;sh&quot;&gt;&lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;git show REVISION:&amp;lt;path/to/file&amp;gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;Or, redirect it to a file.&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-sh&quot; data-lang=&quot;sh&quot;&gt;&lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;git show REVISION:&amp;lt;path/to/file&amp;gt; &lt;span class=&quot;o&quot;&gt;&amp;gt;&lt;/span&gt; &amp;lt;file_name&amp;gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;&lt;a href=&quot;http://stackoverflow.com/questions/338436/is-there-a-quick-git-command-to-see-an-old-version-of-a-file&quot; target=&quot;_blank&quot;&gt;View on StackOverflow&lt;/a&gt;&lt;/p&gt;

&lt;h1 id=&quot;git-update&quot;&gt;git update&lt;/h1&gt;

&lt;h2 id=&quot;ignore-tracked-local-file&quot;&gt;Ignore tracked local file&lt;/h2&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-sh&quot; data-lang=&quot;sh&quot;&gt;&lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;git update-index &lt;span class=&quot;nt&quot;&gt;--assume-unchanged&lt;/span&gt; &amp;lt;file&amp;gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;Corresponding undo operation is as follows.&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-sh&quot; data-lang=&quot;sh&quot;&gt;&lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;git update-index &lt;span class=&quot;nt&quot;&gt;--no-assume-unchanged&lt;/span&gt; &amp;lt;file&amp;gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

</description>
                <pubDate>Thu, 09 Oct 2014 00:00:00 +0800</pubDate>
                <link>https://mr.mk/notes/note/2014/10/09/git/</link>
                <guid isPermaLink="true">https://mr.mk/notes/note/2014/10/09/git/</guid>
            </item>
        
    </channel>
</rss>
