mirror of
https://github.com/jaywcjlove/reference.git
synced 2025-06-19 21:51:20 +08:00
feat: add es6.md
cheatsheet. b258494776
This commit is contained in:
@ -34,15 +34,15 @@
|
||||
document.documentElement.setAttribute('data-color-mode', mode);
|
||||
localStorage.setItem(LOCAL_NANE, mode);
|
||||
}
|
||||
</script><a href="https://github.com/jaywcjlove/reference" class="" target="__blank"><svg viewBox="0 0 16 16" fill="currentColor" height="1em" width="1em"><path d="M8 0C3.58 0 0 3.58 0 8c0 3.54 2.29 6.53 5.47 7.59.4.07.55-.17.55-.38 0-.19-.01-.82-.01-1.49-2.01.37-2.53-.49-2.69-.94-.09-.23-.48-.94-.82-1.13-.28-.15-.68-.52-.01-.53.63-.01 1.08.58 1.23.82.72 1.21 1.87.87 2.33.66.07-.52.28-.87.51-1.07-1.78-.2-3.64-.89-3.64-3.95 0-.87.31-1.59.82-2.15-.08-.2-.36-1.02.08-2.12 0 0 .67-.21 2.2.82.64-.18 1.32-.27 2-.27.68 0 1.36.09 2 .27 1.53-1.04 2.2-.82 2.2-.82.44 1.1.16 1.92.08 2.12.51.56.82 1.27.82 2.15 0 3.07-1.87 3.75-3.65 3.95.29.25.54.73.54 1.48 0 1.07-.01 1.93-.01 2.2 0 .21.15.46.55.38A8.012 8.012 0 0 0 16 8c0-4.42-3.58-8-8-8z"></path></svg></a></div></div></nav><div class="wrap max-container"><header class="wrap-header h1wrap"><h1 id="git-备忘清单"><svg xmlns="http://www.w3.org/2000/svg" fill="currentColor" viewBox="0 0 16 16" height="1em" width="1em">
|
||||
</script><a href="https://github.com/jaywcjlove/reference" class="" target="__blank"><svg viewBox="0 0 16 16" fill="currentColor" height="1em" width="1em"><path d="M8 0C3.58 0 0 3.58 0 8c0 3.54 2.29 6.53 5.47 7.59.4.07.55-.17.55-.38 0-.19-.01-.82-.01-1.49-2.01.37-2.53-.49-2.69-.94-.09-.23-.48-.94-.82-1.13-.28-.15-.68-.52-.01-.53.63-.01 1.08.58 1.23.82.72 1.21 1.87.87 2.33.66.07-.52.28-.87.51-1.07-1.78-.2-3.64-.89-3.64-3.95 0-.87.31-1.59.82-2.15-.08-.2-.36-1.02.08-2.12 0 0 .67-.21 2.2.82.64-.18 1.32-.27 2-.27.68 0 1.36.09 2 .27 1.53-1.04 2.2-.82 2.2-.82.44 1.1.16 1.92.08 2.12.51.56.82 1.27.82 2.15 0 3.07-1.87 3.75-3.65 3.95.29.25.54.73.54 1.48 0 1.07-.01 1.93-.01 2.2 0 .21.15.46.55.38A8.012 8.012 0 0 0 16 8c0-4.42-3.58-8-8-8z"></path></svg></a></div></div></nav><div class="wrap h1body-exist max-container"><header class="wrap-header h1wrap"><h1 id="git-备忘清单"><svg xmlns="http://www.w3.org/2000/svg" fill="currentColor" viewBox="0 0 16 16" height="1em" width="1em">
|
||||
<path d="M15.698 7.287 8.712.302a1.03 1.03 0 0 0-1.457 0l-1.45 1.45 1.84 1.84a1.223 1.223 0 0 1 1.55 1.56l1.773 1.774a1.224 1.224 0 0 1 1.267 2.025 1.226 1.226 0 0 1-2.002-1.334L8.58 5.963v4.353a1.226 1.226 0 1 1-1.008-.036V5.887a1.226 1.226 0 0 1-.666-1.608L5.093 2.465l-4.79 4.79a1.03 1.03 0 0 0 0 1.457l6.986 6.986a1.03 1.03 0 0 0 1.457 0l6.953-6.953a1.031 1.031 0 0 0 0-1.457"></path>
|
||||
</svg>
|
||||
<a aria-hidden="true" tabindex="-1" href="#git-备忘清单"><span class="icon icon-link"></span></a>Git 备忘清单</h1><div class="wrap-body">
|
||||
<p>本备忘单总结了常用的 <a href="https://git-scm.com/">Git</a> 命令行指令,以供快速参考。</p>
|
||||
</div></header><div class="menu-tocs"><div class="menu-btn"><svg aria-hidden="true" fill="currentColor" height="1em" width="1em" viewBox="0 0 16 16" version="1.1" data-view-component="true">
|
||||
<path fill-rule="evenodd" d="M2 4a1 1 0 100-2 1 1 0 000 2zm3.75-1.5a.75.75 0 000 1.5h8.5a.75.75 0 000-1.5h-8.5zm0 5a.75.75 0 000 1.5h8.5a.75.75 0 000-1.5h-8.5zm0 5a.75.75 0 000 1.5h8.5a.75.75 0 000-1.5h-8.5zM3 8a1 1 0 11-2 0 1 1 0 012 0zm-1 6a1 1 0 100-2 1 1 0 000 2z"></path>
|
||||
</svg></div><div class="menu-modal"><a aria-hidden="true" class="leve2 tocs-link" href="#入门">入门</a><a aria-hidden="true" class="leve3 tocs-link" href="#创建存储库">创建存储库</a><a aria-hidden="true" class="leve3 tocs-link" href="#做出改变">做出改变</a><a aria-hidden="true" class="leve3 tocs-link" href="#配置">配置</a><a aria-hidden="true" class="leve3 tocs-link" href="#使用分支">使用分支</a><a aria-hidden="true" class="leve3 tocs-link" href="#观察你的存储库">观察你的存储库</a><a aria-hidden="true" class="leve3 tocs-link" href="#同步">同步</a><a aria-hidden="true" class="leve3 tocs-link" href="#远程">远程</a><a aria-hidden="true" class="leve3 tocs-link" href="#临时提交">临时提交</a><a aria-hidden="true" class="leve3 tocs-link" href="#跟踪路径更改">跟踪路径更改</a><a aria-hidden="true" class="leve3 tocs-link" href="#忽略文件">忽略文件</a><a aria-hidden="true" class="leve2 tocs-link" href="#git-技巧">Git 技巧</a><a aria-hidden="true" class="leve3 tocs-link" href="#重命名分支">重命名分支</a><a aria-hidden="true" class="leve3 tocs-link" href="#log">Log</a><a aria-hidden="true" class="leve3 tocs-link" href="#分支">分支</a><a aria-hidden="true" class="leve3 tocs-link" href="#commit">Commit</a><a aria-hidden="true" class="leve3 tocs-link" href="#忽略文件的权限变化">忽略文件的权限变化</a><a aria-hidden="true" class="leve3 tocs-link" href="#git-别名">Git 别名</a><a aria-hidden="true" class="leve3 tocs-link" href="#设置大小写敏感">设置大小写敏感</a><a aria-hidden="true" class="leve3 tocs-link" href="#修改远程-commit-记录">修改远程 Commit 记录</a><a aria-hidden="true" class="leve3 tocs-link" href="#撤销远程记录">撤销远程记录</a><a aria-hidden="true" class="leve3 tocs-link" href="#放弃本地修改内容">放弃本地修改内容</a><a aria-hidden="true" class="leve3 tocs-link" href="#获取最近一次提交的-hash">获取最近一次提交的 Hash</a><a aria-hidden="true" class="leve3 tocs-link" href="#删除已经合并到-master-的分支">删除已经合并到 master 的分支</a><a aria-hidden="true" class="leve3 tocs-link" href="#中文乱码的解决方案">中文乱码的解决方案</a><a aria-hidden="true" class="leve3 tocs-link" href="#把-a-分支的某一个-commit放到-b-分支上">把 A 分支的某一个 commit,放到 B 分支上</a></div></div><div class="h1wrap-body"><div class="wrap"><div class="wrap-header h2wrap"><h2 id="入门"><a aria-hidden="true" tabindex="-1" href="#入门"><span class="icon icon-link"></span></a>入门</h2><div class="wrap-body">
|
||||
</div></div><div class="h2wrap-body"><div class="wrap"><div class="wrap-header h3wrap"><h3 id="创建存储库"><a aria-hidden="true" tabindex="-1" href="#创建存储库"><span class="icon icon-link"></span></a>创建存储库</h3><div class="wrap-body">
|
||||
</svg></div><div class="menu-modal"><a aria-hidden="true" class="leve2 tocs-link" href="#入门">入门</a><a aria-hidden="true" class="leve3 tocs-link" href="#创建存储库">创建存储库</a><a aria-hidden="true" class="leve3 tocs-link" href="#做出改变">做出改变</a><a aria-hidden="true" class="leve3 tocs-link" href="#配置">配置</a><a aria-hidden="true" class="leve3 tocs-link" href="#使用分支">使用分支</a><a aria-hidden="true" class="leve3 tocs-link" href="#观察你的存储库">观察你的存储库</a><a aria-hidden="true" class="leve3 tocs-link" href="#同步">同步</a><a aria-hidden="true" class="leve3 tocs-link" href="#远程">远程</a><a aria-hidden="true" class="leve3 tocs-link" href="#临时提交">临时提交</a><a aria-hidden="true" class="leve3 tocs-link" href="#跟踪路径更改">跟踪路径更改</a><a aria-hidden="true" class="leve3 tocs-link" href="#忽略文件">忽略文件</a><a aria-hidden="true" class="leve2 tocs-link" href="#git-技巧">Git 技巧</a><a aria-hidden="true" class="leve3 tocs-link" href="#重命名分支">重命名分支</a><a aria-hidden="true" class="leve3 tocs-link" href="#log">Log</a><a aria-hidden="true" class="leve3 tocs-link" href="#分支">分支</a><a aria-hidden="true" class="leve3 tocs-link" href="#commit">Commit</a><a aria-hidden="true" class="leve3 tocs-link" href="#忽略文件的权限变化">忽略文件的权限变化</a><a aria-hidden="true" class="leve3 tocs-link" href="#git-别名">Git 别名</a><a aria-hidden="true" class="leve3 tocs-link" href="#设置大小写敏感">设置大小写敏感</a><a aria-hidden="true" class="leve3 tocs-link" href="#修改远程-commit-记录">修改远程 Commit 记录</a><a aria-hidden="true" class="leve3 tocs-link" href="#撤销远程记录">撤销远程记录</a><a aria-hidden="true" class="leve3 tocs-link" href="#放弃本地修改内容">放弃本地修改内容</a><a aria-hidden="true" class="leve3 tocs-link" href="#获取最近一次提交的-hash">获取最近一次提交的 Hash</a><a aria-hidden="true" class="leve3 tocs-link" href="#删除已经合并到-master-的分支">删除已经合并到 master 的分支</a><a aria-hidden="true" class="leve3 tocs-link" href="#中文乱码的解决方案">中文乱码的解决方案</a><a aria-hidden="true" class="leve3 tocs-link" href="#把-a-分支的某一个-commit放到-b-分支上">把 A 分支的某一个 commit,放到 B 分支上</a></div></div><div class="h1wrap-body"><div class="wrap h2body-exist"><div class="wrap-header h2wrap"><h2 id="入门"><a aria-hidden="true" tabindex="-1" href="#入门"><span class="icon icon-link"></span></a>入门</h2><div class="wrap-body">
|
||||
</div></div><div class="h2wrap-body"><div class="wrap h3body-not-exist"><div class="wrap-header h3wrap"><h3 id="创建存储库"><a aria-hidden="true" tabindex="-1" href="#创建存储库"><span class="icon icon-link"></span></a>创建存储库</h3><div class="wrap-body">
|
||||
<p>创建一个新的本地存储库</p>
|
||||
<pre class="language-shell"><code class="language-shell code-highlight"><span class="code-line">$ <span class="token function">git</span> init <span class="token punctuation">[</span>project name<span class="token punctuation">]</span>
|
||||
</span></code></pre>
|
||||
@ -52,7 +52,7 @@
|
||||
<p>将存储库克隆到指定目录</p>
|
||||
<pre class="language-shell"><code class="language-shell code-highlight"><span class="code-line">$ <span class="token function">git</span> clone git_url 指定目录
|
||||
</span></code></pre>
|
||||
</div></div></div><div class="wrap row-span-2"><div class="wrap-header h3wrap"><h3 id="做出改变"><a aria-hidden="true" tabindex="-1" href="#做出改变"><span class="icon icon-link"></span></a>做出改变</h3><div class="wrap-body">
|
||||
</div></div></div><div class="wrap h3body-not-exist row-span-2"><div class="wrap-header h3wrap"><h3 id="做出改变"><a aria-hidden="true" tabindex="-1" href="#做出改变"><span class="icon icon-link"></span></a>做出改变</h3><div class="wrap-body">
|
||||
<!--rehype:wrap-class=row-span-2-->
|
||||
<p>在工作目录中<strong>显示</strong>修改后的文件,为您的下一次提交暂存</p>
|
||||
<pre class="language-shell"><code class="language-shell code-highlight"><span class="code-line">$ <span class="token function">git</span> status
|
||||
@ -84,7 +84,7 @@
|
||||
<p>在指定分支之前应用当前分支的任何提交</p>
|
||||
<pre class="language-shell"><code class="language-shell code-highlight"><span class="code-line">$ <span class="token function">git</span> rebase <span class="token punctuation">[</span>branch<span class="token punctuation">]</span>
|
||||
</span></code></pre>
|
||||
</div></div></div><div class="wrap"><div class="wrap-header h3wrap"><h3 id="配置"><a aria-hidden="true" tabindex="-1" href="#配置"><span class="icon icon-link"></span></a>配置</h3><div class="wrap-body">
|
||||
</div></div></div><div class="wrap h3body-not-exist"><div class="wrap-header h3wrap"><h3 id="配置"><a aria-hidden="true" tabindex="-1" href="#配置"><span class="icon icon-link"></span></a>配置</h3><div class="wrap-body">
|
||||
<p>设置将附加到您的提交和标签的名称</p>
|
||||
<pre class="language-shell"><code class="language-shell code-highlight"><span class="code-line">$ <span class="token function">git</span> config <span class="token parameter variable">--global</span> user.name <span class="token string">"name"</span>
|
||||
</span></code></pre>
|
||||
@ -97,7 +97,7 @@
|
||||
<p>在文本编辑器中编辑全局配置文件</p>
|
||||
<pre class="language-shell"><code class="language-shell code-highlight"><span class="code-line">$ <span class="token function">git</span> config <span class="token parameter variable">--global</span> <span class="token parameter variable">--edit</span>
|
||||
</span></code></pre>
|
||||
</div></div></div><div class="wrap"><div class="wrap-header h3wrap"><h3 id="使用分支"><a aria-hidden="true" tabindex="-1" href="#使用分支"><span class="icon icon-link"></span></a>使用分支</h3><div class="wrap-body">
|
||||
</div></div></div><div class="wrap h3body-not-exist"><div class="wrap-header h3wrap"><h3 id="使用分支"><a aria-hidden="true" tabindex="-1" href="#使用分支"><span class="icon icon-link"></span></a>使用分支</h3><div class="wrap-body">
|
||||
<p>列出所有本地分支</p>
|
||||
<pre class="language-shell"><code class="language-shell code-highlight"><span class="code-line">$ <span class="token function">git</span> branch
|
||||
</span></code></pre>
|
||||
@ -120,7 +120,7 @@
|
||||
<p>标记当前提交</p>
|
||||
<pre class="language-shell"><code class="language-shell code-highlight"><span class="code-line">$ <span class="token function">git</span> tag my_tag
|
||||
</span></code></pre>
|
||||
</div></div></div><div class="wrap"><div class="wrap-header h3wrap"><h3 id="观察你的存储库"><a aria-hidden="true" tabindex="-1" href="#观察你的存储库"><span class="icon icon-link"></span></a>观察你的存储库</h3><div class="wrap-body">
|
||||
</div></div></div><div class="wrap h3body-not-exist"><div class="wrap-header h3wrap"><h3 id="观察你的存储库"><a aria-hidden="true" tabindex="-1" href="#观察你的存储库"><span class="icon icon-link"></span></a>观察你的存储库</h3><div class="wrap-body">
|
||||
<p>显示当前活动分支的提交历史</p>
|
||||
<pre class="language-shell"><code class="language-shell code-highlight"><span class="code-line">$ <span class="token function">git</span> log
|
||||
</span></code></pre>
|
||||
@ -136,7 +136,7 @@
|
||||
<p>以人类可读的格式显示 Git 中的任何对象</p>
|
||||
<pre class="language-shell"><code class="language-shell code-highlight"><span class="code-line">$ <span class="token function">git</span> show <span class="token punctuation">[</span>SHA<span class="token punctuation">]</span>
|
||||
</span></code></pre>
|
||||
</div></div></div><div class="wrap"><div class="wrap-header h3wrap"><h3 id="同步"><a aria-hidden="true" tabindex="-1" href="#同步"><span class="icon icon-link"></span></a>同步</h3><div class="wrap-body">
|
||||
</div></div></div><div class="wrap h3body-not-exist"><div class="wrap-header h3wrap"><h3 id="同步"><a aria-hidden="true" tabindex="-1" href="#同步"><span class="icon icon-link"></span></a>同步</h3><div class="wrap-body">
|
||||
<p>从该 Git 远程获取所有分支</p>
|
||||
<pre class="language-shell"><code class="language-shell code-highlight"><span class="code-line">$ <span class="token function">git</span> fetch <span class="token punctuation">[</span>alias<span class="token punctuation">]</span>
|
||||
</span></code></pre>
|
||||
@ -156,7 +156,7 @@
|
||||
<p>将另一个分支的一个特定提交合并到当前分支</p>
|
||||
<pre class="language-shell"><code class="language-shell code-highlight"><span class="code-line">$ <span class="token function">git</span> cherry-pick <span class="token punctuation">[</span>commit_id<span class="token punctuation">]</span>
|
||||
</span></code></pre>
|
||||
</div></div></div><div class="wrap"><div class="wrap-header h3wrap"><h3 id="远程"><a aria-hidden="true" tabindex="-1" href="#远程"><span class="icon icon-link"></span></a>远程</h3><div class="wrap-body">
|
||||
</div></div></div><div class="wrap h3body-not-exist"><div class="wrap-header h3wrap"><h3 id="远程"><a aria-hidden="true" tabindex="-1" href="#远程"><span class="icon icon-link"></span></a>远程</h3><div class="wrap-body">
|
||||
<p>添加一个 git URL 作为别名</p>
|
||||
<pre class="language-shell"><code class="language-shell code-highlight"><span class="code-line">$ <span class="token function">git</span> remote <span class="token function">add</span> <span class="token punctuation">[</span>alias<span class="token punctuation">]</span> <span class="token punctuation">[</span>url<span class="token punctuation">]</span>
|
||||
</span></code></pre>
|
||||
@ -172,7 +172,7 @@
|
||||
<p>更改 git repo 的 URL</p>
|
||||
<pre class="language-shell"><code class="language-shell code-highlight"><span class="code-line">$ <span class="token function">git</span> remote set-url origin <span class="token punctuation">[</span>git_url<span class="token punctuation">]</span>
|
||||
</span></code></pre>
|
||||
</div></div></div><div class="wrap"><div class="wrap-header h3wrap"><h3 id="临时提交"><a aria-hidden="true" tabindex="-1" href="#临时提交"><span class="icon icon-link"></span></a>临时提交</h3><div class="wrap-body">
|
||||
</div></div></div><div class="wrap h3body-not-exist"><div class="wrap-header h3wrap"><h3 id="临时提交"><a aria-hidden="true" tabindex="-1" href="#临时提交"><span class="icon icon-link"></span></a>临时提交</h3><div class="wrap-body">
|
||||
<p>保存已修改和分阶段的更改</p>
|
||||
<pre class="language-shell"><code class="language-shell code-highlight"><span class="code-line">$ <span class="token function">git</span> stash
|
||||
</span></code></pre>
|
||||
@ -185,7 +185,7 @@
|
||||
<p>丢弃存储堆栈顶部的更改</p>
|
||||
<pre class="language-shell"><code class="language-shell code-highlight"><span class="code-line">$ <span class="token function">git</span> stash drop
|
||||
</span></code></pre>
|
||||
</div></div></div><div class="wrap"><div class="wrap-header h3wrap"><h3 id="跟踪路径更改"><a aria-hidden="true" tabindex="-1" href="#跟踪路径更改"><span class="icon icon-link"></span></a>跟踪路径更改</h3><div class="wrap-body">
|
||||
</div></div></div><div class="wrap h3body-not-exist"><div class="wrap-header h3wrap"><h3 id="跟踪路径更改"><a aria-hidden="true" tabindex="-1" href="#跟踪路径更改"><span class="icon icon-link"></span></a>跟踪路径更改</h3><div class="wrap-body">
|
||||
<p>从项目中删除文件并暂存删除以进行提交</p>
|
||||
<pre class="language-shell"><code class="language-shell code-highlight"><span class="code-line">$ <span class="token function">git</span> <span class="token function">rm</span> <span class="token punctuation">[</span>file<span class="token punctuation">]</span>
|
||||
</span></code></pre>
|
||||
@ -195,7 +195,7 @@
|
||||
<p>显示所有提交日志,并指示任何移动的路径</p>
|
||||
<pre class="language-shell"><code class="language-shell code-highlight"><span class="code-line">$ <span class="token function">git</span> log <span class="token parameter variable">--stat</span> <span class="token parameter variable">-M</span>
|
||||
</span></code></pre>
|
||||
</div></div></div><div class="wrap"><div class="wrap-header h3wrap"><h3 id="忽略文件"><a aria-hidden="true" tabindex="-1" href="#忽略文件"><span class="icon icon-link"></span></a>忽略文件</h3><div class="wrap-body">
|
||||
</div></div></div><div class="wrap h3body-not-exist"><div class="wrap-header h3wrap"><h3 id="忽略文件"><a aria-hidden="true" tabindex="-1" href="#忽略文件"><span class="icon icon-link"></span></a>忽略文件</h3><div class="wrap-body">
|
||||
<pre class="language-gitignore"><code class="language-gitignore code-highlight"><span class="code-line"><span class="token entry string"><span class="token punctuation">/</span>logs<span class="token punctuation">/</span><span class="token operator">*</span></span>
|
||||
</span><span class="code-line"><span class="token comment"># “!” 意思是不要忽视</span>
|
||||
</span><span class="code-line"><span class="token entry string"><span class="token operator">!</span>logs<span class="token punctuation">/</span>.gitkeep</span>
|
||||
@ -207,8 +207,8 @@
|
||||
</span><span class="code-line"><span class="token entry string">.sass-cache</span>
|
||||
</span></code></pre>
|
||||
<p><code>.gitignore</code> 文件指定了 Git 应该忽略的未跟踪的文件</p>
|
||||
</div></div></div></div></div><div class="wrap"><div class="wrap-header h2wrap"><h2 id="git-技巧"><a aria-hidden="true" tabindex="-1" href="#git-技巧"><span class="icon icon-link"></span></a>Git 技巧</h2><div class="wrap-body">
|
||||
</div></div><div class="h2wrap-body"><div class="wrap"><div class="wrap-header h3wrap"><h3 id="重命名分支"><a aria-hidden="true" tabindex="-1" href="#重命名分支"><span class="icon icon-link"></span></a>重命名分支</h3><div class="wrap-body">
|
||||
</div></div></div></div></div><div class="wrap h2body-exist"><div class="wrap-header h2wrap"><h2 id="git-技巧"><a aria-hidden="true" tabindex="-1" href="#git-技巧"><span class="icon icon-link"></span></a>Git 技巧</h2><div class="wrap-body">
|
||||
</div></div><div class="h2wrap-body"><div class="wrap h3body-not-exist"><div class="wrap-header h3wrap"><h3 id="重命名分支"><a aria-hidden="true" tabindex="-1" href="#重命名分支"><span class="icon icon-link"></span></a>重命名分支</h3><div class="wrap-body">
|
||||
<ul class="style-timeline">
|
||||
<li><strong>重命名</strong>为<code>new</code>
|
||||
<pre class="language-shell"><code class="language-shell code-highlight"><span class="code-line">$ <span class="token function">git</span> branch <span class="token parameter variable">-m</span> <span class="token operator"><</span>new<span class="token operator">></span>
|
||||
@ -226,7 +226,7 @@
|
||||
</li>
|
||||
</ul>
|
||||
<!--rehype:className=style-timeline-->
|
||||
</div></div></div><div class="wrap"><div class="wrap-header h3wrap"><h3 id="log"><a aria-hidden="true" tabindex="-1" href="#log"><span class="icon icon-link"></span></a>Log</h3><div class="wrap-body">
|
||||
</div></div></div><div class="wrap h3body-not-exist"><div class="wrap-header h3wrap"><h3 id="log"><a aria-hidden="true" tabindex="-1" href="#log"><span class="icon icon-link"></span></a>Log</h3><div class="wrap-body">
|
||||
<p>按内容搜索更改</p>
|
||||
<pre class="language-shell"><code class="language-shell code-highlight"><span class="code-line">$ <span class="token function">git</span> log -S<span class="token string">'<a term in the source>'</span>
|
||||
</span></code></pre>
|
||||
@ -237,7 +237,7 @@
|
||||
<pre class="wrap-text"><code class="language-shell code-highlight"><span class="code-line">$ <span class="token function">git</span> log <span class="token parameter variable">--pretty</span><span class="token operator">=</span>oneline <span class="token parameter variable">--graph</span> <span class="token parameter variable">--decorate</span> <span class="token parameter variable">--all</span>
|
||||
</span></code></pre>
|
||||
<!--rehype:className=wrap-text-->
|
||||
</div></div></div><div class="wrap row-span-2"><div class="wrap-header h3wrap"><h3 id="分支"><a aria-hidden="true" tabindex="-1" href="#分支"><span class="icon icon-link"></span></a>分支</h3><div class="wrap-body">
|
||||
</div></div></div><div class="wrap h3body-not-exist row-span-2"><div class="wrap-header h3wrap"><h3 id="分支"><a aria-hidden="true" tabindex="-1" href="#分支"><span class="icon icon-link"></span></a>分支</h3><div class="wrap-body">
|
||||
<!--rehype:wrap-class=row-span-2-->
|
||||
<p>列出所有分支及其上游</p>
|
||||
<pre class="language-shell"><code class="language-shell code-highlight"><span class="code-line">$ <span class="token function">git</span> branch <span class="token parameter variable">-vv</span>
|
||||
@ -254,22 +254,22 @@
|
||||
<p>删除本地存在远程不存在的分支</p>
|
||||
<pre class="language-shell"><code class="language-shell code-highlight"><span class="code-line"><span class="token function">git</span> remote prune origin
|
||||
</span></code></pre>
|
||||
</div></div></div><div class="wrap"><div class="wrap-header h3wrap"><h3 id="commit"><a aria-hidden="true" tabindex="-1" href="#commit"><span class="icon icon-link"></span></a>Commit</h3><div class="wrap-body">
|
||||
</div></div></div><div class="wrap h3body-not-exist"><div class="wrap-header h3wrap"><h3 id="commit"><a aria-hidden="true" tabindex="-1" href="#commit"><span class="icon icon-link"></span></a>Commit</h3><div class="wrap-body">
|
||||
<pre class="language-shell"><code class="language-shell code-highlight"><span class="code-line">$ <span class="token function">git</span> commit <span class="token parameter variable">-v</span> <span class="token parameter variable">--amend</span>
|
||||
</span></code></pre>
|
||||
<p>重写最后的提交信息</p>
|
||||
</div></div></div><div class="wrap"><div class="wrap-header h3wrap"><h3 id="忽略文件的权限变化"><a aria-hidden="true" tabindex="-1" href="#忽略文件的权限变化"><span class="icon icon-link"></span></a>忽略文件的权限变化</h3><div class="wrap-body">
|
||||
</div></div></div><div class="wrap h3body-not-exist"><div class="wrap-header h3wrap"><h3 id="忽略文件的权限变化"><a aria-hidden="true" tabindex="-1" href="#忽略文件的权限变化"><span class="icon icon-link"></span></a>忽略文件的权限变化</h3><div class="wrap-body">
|
||||
<pre class="language-shell"><code class="language-shell code-highlight"><span class="code-line"><span class="token function">git</span> config core.fileMode <span class="token boolean">false</span>
|
||||
</span></code></pre>
|
||||
<p>不再将文件的权限变化视作改动</p>
|
||||
</div></div></div><div class="wrap"><div class="wrap-header h3wrap"><h3 id="git-别名"><a aria-hidden="true" tabindex="-1" href="#git-别名"><span class="icon icon-link"></span></a>Git 别名</h3><div class="wrap-body">
|
||||
</div></div></div><div class="wrap h3body-not-exist"><div class="wrap-header h3wrap"><h3 id="git-别名"><a aria-hidden="true" tabindex="-1" href="#git-别名"><span class="icon icon-link"></span></a>Git 别名</h3><div class="wrap-body">
|
||||
<pre class="language-shell"><code class="language-shell code-highlight"><span class="code-line">$ <span class="token function">git</span> config <span class="token parameter variable">--global</span> alias.co checkout
|
||||
</span><span class="code-line">$ <span class="token function">git</span> config <span class="token parameter variable">--global</span> alias.br branch
|
||||
</span><span class="code-line">$ <span class="token function">git</span> config <span class="token parameter variable">--global</span> alias.ci commit
|
||||
</span><span class="code-line">$ <span class="token function">git</span> config <span class="token parameter variable">--global</span> alias.st status
|
||||
</span></code></pre>
|
||||
<p>也可以看看:<a href="https://gist.github.com/johnpolacek/69604a1f6861129ef088">更多别名</a></p>
|
||||
</div></div></div><div class="wrap"><div class="wrap-header h3wrap"><h3 id="设置大小写敏感"><a aria-hidden="true" tabindex="-1" href="#设置大小写敏感"><span class="icon icon-link"></span></a>设置大小写敏感</h3><div class="wrap-body">
|
||||
</div></div></div><div class="wrap h3body-not-exist"><div class="wrap-header h3wrap"><h3 id="设置大小写敏感"><a aria-hidden="true" tabindex="-1" href="#设置大小写敏感"><span class="icon icon-link"></span></a>设置大小写敏感</h3><div class="wrap-body">
|
||||
<pre class="language-shell"><code class="language-shell code-highlight"><span class="code-line"><span class="token comment"># 查看git 的设置</span>
|
||||
</span><span class="code-line">$ <span class="token function">git</span> config <span class="token parameter variable">--get</span> core.ignorecase
|
||||
</span><span class="code-line"><span class="token comment"># 设置大小写敏感</span>
|
||||
@ -277,7 +277,7 @@
|
||||
</span><span class="code-line"><span class="token comment"># 远程有俩相同目录,通过这种方式清除掉,然后提交记录</span>
|
||||
</span><span class="code-line">$ <span class="token function">git</span> <span class="token function">rm</span> <span class="token parameter variable">-r</span> <span class="token parameter variable">--cached</span> <span class="token operator"><</span>目录/文件<span class="token operator">></span>
|
||||
</span></code></pre>
|
||||
</div></div></div><div class="wrap row-span-4"><div class="wrap-header h3wrap"><h3 id="修改远程-commit-记录"><a aria-hidden="true" tabindex="-1" href="#修改远程-commit-记录"><span class="icon icon-link"></span></a>修改远程 Commit 记录</h3><div class="wrap-body">
|
||||
</div></div></div><div class="wrap h3body-not-exist row-span-4"><div class="wrap-header h3wrap"><h3 id="修改远程-commit-记录"><a aria-hidden="true" tabindex="-1" href="#修改远程-commit-记录"><span class="icon icon-link"></span></a>修改远程 Commit 记录</h3><div class="wrap-body">
|
||||
<!--rehype:wrap-class=row-span-4-->
|
||||
<pre class="language-shell"><code class="language-shell code-highlight"><span class="code-line">$ <span class="token function">git</span> rebase <span class="token parameter variable">-i</span> HEAD~3
|
||||
</span><span class="code-line"><span class="token comment"># 表示要修改当前版本的倒数第三次状态</span>
|
||||
@ -315,13 +315,13 @@
|
||||
</span><span class="code-line"><span class="token comment"># 最后,确保没有人提交进行推送,最好不要加 -f 强制推送</span>
|
||||
</span><span class="code-line">$ <span class="token function">git</span> push <span class="token parameter variable">-f</span> origin master
|
||||
</span></code></pre>
|
||||
</div></div></div><div class="wrap"><div class="wrap-header h3wrap"><h3 id="撤销远程记录"><a aria-hidden="true" tabindex="-1" href="#撤销远程记录"><span class="icon icon-link"></span></a>撤销远程记录</h3><div class="wrap-body">
|
||||
</div></div></div><div class="wrap h3body-not-exist"><div class="wrap-header h3wrap"><h3 id="撤销远程记录"><a aria-hidden="true" tabindex="-1" href="#撤销远程记录"><span class="icon icon-link"></span></a>撤销远程记录</h3><div class="wrap-body">
|
||||
<pre class="language-shell"><code class="language-shell code-highlight"><span class="code-line"><span class="token comment"># 撤销一条记录 </span>
|
||||
</span><span class="code-line">$ <span class="token function">git</span> reset <span class="token parameter variable">--hard</span> HEAD~1
|
||||
</span><span class="code-line"><span class="token comment"># 强制同步到远程仓库 </span>
|
||||
</span><span class="code-line">$ <span class="token function">git</span> push <span class="token parameter variable">-f</span> origin HEAD:master
|
||||
</span></code></pre>
|
||||
</div></div></div><div class="wrap"><div class="wrap-header h3wrap"><h3 id="放弃本地修改内容"><a aria-hidden="true" tabindex="-1" href="#放弃本地修改内容"><span class="icon icon-link"></span></a>放弃本地修改内容</h3><div class="wrap-body">
|
||||
</div></div></div><div class="wrap h3body-not-exist"><div class="wrap-header h3wrap"><h3 id="放弃本地修改内容"><a aria-hidden="true" tabindex="-1" href="#放弃本地修改内容"><span class="icon icon-link"></span></a>放弃本地修改内容</h3><div class="wrap-body">
|
||||
<pre class="language-shell"><code class="language-shell code-highlight"><span class="code-line"><span class="token comment"># 如果有的修改以及加入暂存区的话</span>
|
||||
</span><span class="code-line">$ <span class="token function">git</span> reset <span class="token parameter variable">--hard</span>
|
||||
</span><span class="code-line"><span class="token comment"># 还原所有修改,不会删除新增的文件</span>
|
||||
@ -329,19 +329,19 @@
|
||||
</span><span class="code-line"><span class="token comment"># 下面命令会删除新增的文件</span>
|
||||
</span><span class="code-line">$ <span class="token function">git</span> clean <span class="token parameter variable">-xdf</span>
|
||||
</span></code></pre>
|
||||
</div></div></div><div class="wrap"><div class="wrap-header h3wrap"><h3 id="获取最近一次提交的-hash"><a aria-hidden="true" tabindex="-1" href="#获取最近一次提交的-hash"><span class="icon icon-link"></span></a>获取最近一次提交的 Hash</h3><div class="wrap-body">
|
||||
</div></div></div><div class="wrap h3body-not-exist"><div class="wrap-header h3wrap"><h3 id="获取最近一次提交的-hash"><a aria-hidden="true" tabindex="-1" href="#获取最近一次提交的-hash"><span class="icon icon-link"></span></a>获取最近一次提交的 Hash</h3><div class="wrap-body">
|
||||
<pre class="language-shell"><code class="language-shell code-highlight"><span class="code-line">$ <span class="token function">git</span> rev-parse HEAD <span class="token comment"># e10721cb8859b2c</span>
|
||||
</span><span class="code-line"><span class="token comment"># 获取短 hash</span>
|
||||
</span><span class="code-line">$ <span class="token function">git</span> rev-parse <span class="token parameter variable">--short</span> HEAD <span class="token comment"># e10721c</span>
|
||||
</span></code></pre>
|
||||
</div></div></div><div class="wrap"><div class="wrap-header h3wrap"><h3 id="删除已经合并到-master-的分支"><a aria-hidden="true" tabindex="-1" href="#删除已经合并到-master-的分支"><span class="icon icon-link"></span></a>删除已经合并到 master 的分支</h3><div class="wrap-body">
|
||||
</div></div></div><div class="wrap h3body-not-exist"><div class="wrap-header h3wrap"><h3 id="删除已经合并到-master-的分支"><a aria-hidden="true" tabindex="-1" href="#删除已经合并到-master-的分支"><span class="icon icon-link"></span></a>删除已经合并到 master 的分支</h3><div class="wrap-body">
|
||||
<pre class="wrap-text"><code class="language-shell code-highlight"><span class="code-line">$ <span class="token function">git</span> branch <span class="token parameter variable">--merged</span> master <span class="token operator">|</span> <span class="token function">grep</span> <span class="token parameter variable">-v</span> <span class="token string">'^\*\| master'</span> <span class="token operator">|</span> <span class="token function">xargs</span> <span class="token parameter variable">-n</span> <span class="token number">1</span> <span class="token function">git</span> branch <span class="token parameter variable">-d</span>
|
||||
</span></code></pre>
|
||||
<!--rehype:className=wrap-text-->
|
||||
</div></div></div><div class="wrap"><div class="wrap-header h3wrap"><h3 id="中文乱码的解决方案"><a aria-hidden="true" tabindex="-1" href="#中文乱码的解决方案"><span class="icon icon-link"></span></a>中文乱码的解决方案</h3><div class="wrap-body">
|
||||
</div></div></div><div class="wrap h3body-not-exist"><div class="wrap-header h3wrap"><h3 id="中文乱码的解决方案"><a aria-hidden="true" tabindex="-1" href="#中文乱码的解决方案"><span class="icon icon-link"></span></a>中文乱码的解决方案</h3><div class="wrap-body">
|
||||
<pre class="language-shell"><code class="language-shell code-highlight"><span class="code-line">$ <span class="token function">git</span> config <span class="token parameter variable">--global</span> core.quotepath <span class="token boolean">false</span>
|
||||
</span></code></pre>
|
||||
</div></div></div><div class="wrap"><div class="wrap-header h3wrap"><h3 id="把-a-分支的某一个-commit放到-b-分支上"><a aria-hidden="true" tabindex="-1" href="#把-a-分支的某一个-commit放到-b-分支上"><span class="icon icon-link"></span></a>把 A 分支的某一个 commit,放到 B 分支上</h3><div class="wrap-body">
|
||||
</div></div></div><div class="wrap h3body-not-exist"><div class="wrap-header h3wrap"><h3 id="把-a-分支的某一个-commit放到-b-分支上"><a aria-hidden="true" tabindex="-1" href="#把-a-分支的某一个-commit放到-b-分支上"><span class="icon icon-link"></span></a>把 A 分支的某一个 commit,放到 B 分支上</h3><div class="wrap-body">
|
||||
<pre class="language-shell"><code class="language-shell code-highlight"><span class="code-line"><span class="token comment"># 切换到 B 分支</span>
|
||||
</span><span class="code-line">$ <span class="token function">git</span> checkout <span class="token operator"><</span>B<span class="token operator">></span>
|
||||
</span><span class="code-line"><span class="token comment"># 将 A 分支 <hash-id> 的内容 pick 到 B 分支</span>
|
||||
@ -360,8 +360,6 @@ function anchorPoint() {
|
||||
Array.from(document.querySelectorAll('.h2wrap-body .wrap')).forEach((elm) => elm.classList.remove('active'))
|
||||
if (elm?.tagName === 'H3') {
|
||||
elm?.parentElement?.parentElement?.classList.add('active');
|
||||
const box = elm?.parentElement?.parentElement;
|
||||
console.log('elm:2', box, document.querySelectorAll('.h2wrap-body .wrap'))
|
||||
}
|
||||
}
|
||||
anchorPoint();
|
||||
@ -372,7 +370,6 @@ function updateAnchor(element) {
|
||||
tocanchor.classList.remove('is-active-link');
|
||||
});
|
||||
const anchor = element || document.querySelector(`a.tocs-link[href='${decodeURIComponent(window.location.hash)}']`);
|
||||
console.log('anchor', anchor)
|
||||
if (anchor) {
|
||||
anchor.classList.add('is-active-link');
|
||||
}
|
||||
|
Reference in New Issue
Block a user