<?xml version="1.0" encoding="utf-8"?><feed xmlns="http://www.w3.org/2005/Atom" ><generator uri="https://jekyllrb.com/" version="3.9.3">Jekyll</generator><link href="https://landon100100.github.io/feed.xml" rel="self" type="application/atom+xml" /><link href="https://landon100100.github.io/" rel="alternate" type="text/html" /><updated>2024-01-12T07:25:58+00:00</updated><id>https://landon100100.github.io/feed.xml</id><title type="html">Landon100100</title><subtitle>Web Developer from Somewhere</subtitle><entry><title type="html">Gi第01天</title><link href="https://landon100100.github.io/Gi%E7%AC%AC01%E5%A4%A9/" rel="alternate" type="text/html" title="Gi第01天" /><published>2024-01-06T00:00:00+00:00</published><updated>2024-01-06T00:00:00+00:00</updated><id>https://landon100100.github.io/Gi%E7%AC%AC01%E5%A4%A9</id><content type="html" xml:base="https://landon100100.github.io/Gi%E7%AC%AC01%E5%A4%A9/">&lt;h2 id=&quot;一git&quot;&gt;一:Git&lt;/h2&gt;

&lt;h3 id=&quot;11-版本管理&quot;&gt;1.1 版本管理&lt;/h3&gt;

&lt;p&gt;编码的时候有些节点非常关键,那我们就可以存个档,以防出现代码丢失等意外.&lt;/p&gt;

&lt;p&gt;结合游戏存档来理解&lt;/p&gt;

&lt;h3 id=&quot;12-常见版本管理软件&quot;&gt;1.2 常见版本管理软件&lt;/h3&gt;

&lt;p&gt;a.&lt;strong&gt;svn&lt;/strong&gt;(集中式)&lt;/p&gt;

&lt;p&gt;b.&lt;strong&gt;git&lt;/strong&gt;(分布式)&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://www.liaoxuefeng.com/wiki/896043488029600/896202780297248&quot;&gt;集中式和分布式的区别&lt;/a&gt;&lt;/p&gt;

&lt;h4 id=&quot;121-git安装&quot;&gt;1.2.1 git安装&lt;/h4&gt;

&lt;p&gt;​        选中要安装的软件,&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;https://mypicgo-1312526752.cos.ap-guangzhou.myqcloud.com/image/1561255270875.webp&quot; alt=&quot;img&quot; /&gt;
​        直接一直下一步,用默认盘符就行.&lt;/p&gt;

&lt;p&gt;​        右键出现git bash就表示安装成功&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;https://mypicgo-1312526752.cos.ap-guangzhou.myqcloud.com/image/1560215661118.webp&quot; alt=&quot;img&quot; /&gt;&lt;/p&gt;

&lt;h3 id=&quot;13-git使用步骤&quot;&gt;1.3 git使用步骤&lt;/h3&gt;

&lt;p&gt;1.新建一个文件夹 (新建的仓库和编写的代码都写在这个文件夹中)&lt;/p&gt;

&lt;p&gt;2.进入到文件夹, 右键 点击  Git Bash Here&lt;img src=&quot;./assets/1561255397522.webp&quot; alt=&quot;img&quot; /&gt;,他就会出现一个小黑框&lt;/p&gt;

&lt;p&gt;3.就在小黑框里写:  git init    (意思是初始化一个仓库)&lt;/p&gt;

&lt;p&gt;​    会出现一个隐藏的.git文件夹. 不要动这个文件夹.&lt;/p&gt;

&lt;p&gt;4.吃着火锅,愉快的敲着代码..&lt;/p&gt;

&lt;p&gt;5.git  add  .&lt;/p&gt;

&lt;p&gt;​	git   commit   -m “描述提交的代码”&lt;/p&gt;

&lt;h3 id=&quot;14-补充&quot;&gt;1.4 补充:&lt;/h3&gt;

&lt;p&gt;​    如果是第一次执行add commit,会出现下面这个问题&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;https://mypicgo-1312526752.cos.ap-guangzhou.myqcloud.com/image/1561256313982.webp&quot; alt=&quot;img&quot; /&gt;&lt;/p&gt;

&lt;p&gt;​      这个问题的意思是: 设置你邮箱和用户名, 这个问题只会在第一次出现.&lt;/p&gt;

&lt;p&gt;​      注意的是:设置的时候一个一个的设置设置好了后再add. commit一下, 如果git status&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;https://mypicgo-1312526752.cos.ap-guangzhou.myqcloud.com/image/1561256053495.webp&quot; alt=&quot;img&quot; /&gt;&lt;/p&gt;

&lt;p&gt;出现了nothing to commit 就表示add commit 成功了&lt;/p&gt;

&lt;p&gt;再git  log&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;https://mypicgo-1312526752.cos.ap-guangzhou.myqcloud.com/image/1561256128351.webp&quot; alt=&quot;img&quot; /&gt;&lt;/p&gt;

&lt;p&gt;查看提交日志,&lt;/p&gt;

&lt;p&gt;​                   这一步有的时候会卡死, 如果卡死按q退出.    或者ctrl+c两次退出&lt;/p&gt;

&lt;h3 id=&quot;15-容易出现的问题-&quot;&gt;==1.5 容易出现的问题 :==&lt;/h3&gt;

&lt;p&gt;1.新建编写代码的文件夹,要进到文件夹里面去之后, 右键点击git bash here&lt;/p&gt;

&lt;p&gt;2.git init 不要写错, 出现一个.git隐藏文件夹,&lt;/p&gt;

&lt;p&gt;​    如果没有出现这个文件夹,检查一下自己的电脑隐藏文件夹是不是不显示.&lt;/p&gt;

&lt;p&gt;3.我们要提交内容, 那首先得有内容. 意思就是要写点代码, 代码要和上次不一样.&lt;/p&gt;

&lt;p&gt;4.git add .&lt;/p&gt;

&lt;p&gt;git commit -m”描述的信息”&lt;/p&gt;

&lt;p&gt;这两句代码  add 和后面的点 有空格.   commit 和-m中间也有空格.&lt;/p&gt;

&lt;p&gt;5.第一次提交会出现让你输入邮箱和用户名, 一行代码一行代码的执行. 复制的时候不要把后面的空格给复制来呀&lt;/p&gt;

&lt;p&gt;6.在浏览器查看git的命令：&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;git help --web 命令名&lt;/code&gt;，如浏览器浏览log的帮助，&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;git help --web log&lt;/code&gt;。&lt;/p&gt;

&lt;h3 id=&quot;16-邮箱和用户名&quot;&gt;1.6 邮箱和用户名&lt;/h3&gt;

&lt;h4 id=&quot;161-查看邮箱和用户名&quot;&gt;1.6.1 查看邮箱和用户名&lt;/h4&gt;

&lt;p&gt;​	  git  config  user.email&lt;/p&gt;

&lt;p&gt;​      git  config  user.name&lt;/p&gt;

&lt;h4 id=&quot;162-修改邮箱和用户名&quot;&gt;1.6.2 修改邮箱和用户名&lt;/h4&gt;

&lt;p&gt;第一种办法:  直接重新再设置一下,他就会覆盖.&lt;/p&gt;

&lt;p&gt;​	git config –global user.email  “you@example.com”&lt;/p&gt;

&lt;p&gt;​	git config –global user.name  “Your Name”&lt;/p&gt;

&lt;p&gt;config的三个作用域&lt;/p&gt;

&lt;p&gt;缺省等同于local&lt;/p&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;c&quot;&gt;# local只对某个仓库有效&lt;/span&gt;
git config &lt;span class=&quot;nt&quot;&gt;--local&lt;/span&gt;
&lt;span class=&quot;c&quot;&gt;# global对当前用户所有仓库邮箱&lt;/span&gt;
git config &lt;span class=&quot;nt&quot;&gt;--global&lt;/span&gt;
&lt;span class=&quot;c&quot;&gt;# system对系统所有登录的用户有效&lt;/span&gt;
git config &lt;span class=&quot;nt&quot;&gt;--system&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;显示config的配置，加–list&lt;/p&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;git config &lt;span class=&quot;nt&quot;&gt;--list&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;--local&lt;/span&gt;
git config &lt;span class=&quot;nt&quot;&gt;--list&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;--global&lt;/span&gt;
git config &lt;span class=&quot;nt&quot;&gt;--system&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;第二种办法:  退出再登录&lt;/p&gt;

&lt;p&gt;​        退出:&lt;/p&gt;

&lt;p&gt;​         git  config  –global   –unset  user.email&lt;/p&gt;

&lt;p&gt;​         git  config  –global   –unset  user.name&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;推荐大家使用 github/码云gitee注册的邮箱和用户名来登录.&lt;/strong&gt;&lt;/p&gt;

&lt;h3 id=&quot;17-git版本穿梭回滚&quot;&gt;1.7 git版本穿梭(回滚)&lt;/h3&gt;

&lt;p&gt;命令:   git    reset    –hard  版本号       //版本回滚的命令&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;https://mypicgo-1312526752.cos.ap-guangzhou.myqcloud.com/image/1606204859378.webp&quot; alt=&quot;img&quot; /&gt;&lt;/p&gt;

&lt;p&gt;​           版本号就是git log查看后那个黄色的一串数字,也可以是:&lt;/p&gt;

&lt;p&gt;​           		HEAD^       上一个版本&lt;/p&gt;

&lt;p&gt;​           		HEAD^^     上上一个版本（上两个版本）&lt;/p&gt;

&lt;p&gt;​           		HEAD^^^   上上上一个版本（上三个版本）&lt;/p&gt;

&lt;p&gt;​           例如:&lt;/p&gt;

&lt;p&gt;​     		        git  reset  –hard  HEAD^       //回到当前的上一个版本&lt;/p&gt;

&lt;p&gt;​     				git  reset  –hard  HEAD^^     //回到当前的上上个版本&lt;/p&gt;

&lt;p&gt;命令:   git  log –oneline          //查看一行类型的日志,包括版本号&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;https://mypicgo-1312526752.cos.ap-guangzhou.myqcloud.com/image/1561259844523.webp&quot; alt=&quot;img&quot; /&gt;&lt;/p&gt;

&lt;p&gt;前面黄色的就是版本号&lt;/p&gt;

&lt;p&gt;命令:   git  reflog     //查看所有的日志,包括回滚的日志&lt;/p&gt;

&lt;h5 id=&quot;172-重命名文件&quot;&gt;1.7.2 重命名文件&lt;/h5&gt;

&lt;p&gt;方式1（命令较多）&lt;/p&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nb&quot;&gt;mv &lt;/span&gt;readme readme.md
git add readme.md
git &lt;span class=&quot;nb&quot;&gt;rm &lt;/span&gt;readme
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;方式2&lt;/p&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;git &lt;span class=&quot;nb&quot;&gt;mv &lt;/span&gt;readme readme.md
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;Changes to be committed:
  &lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;use &lt;span class=&quot;s2&quot;&gt;&quot;git restore --staged &amp;lt;file&amp;gt;...&quot;&lt;/span&gt; to unstage&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt;
        renamed:    readme -&amp;gt; readme.md
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&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;'Move readme to readme.md'&lt;/span&gt;
&lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;master f6f9b90] Move readme to readme.md
 1 file changed, 0 insertions&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;+&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt;, 0 deletions&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;-&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt;
 rename readme &lt;span class=&quot;o&quot;&gt;=&amp;gt;&lt;/span&gt; readme.md &lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;100%&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h3 id=&quot;18-本地git工作流程&quot;&gt;1.8 本地git工作流程&lt;/h3&gt;

&lt;p&gt;&lt;img src=&quot;https://mypicgo-1312526752.cos.ap-guangzhou.myqcloud.com/image/1561261071875.webp&quot; alt=&quot;img&quot; /&gt;&lt;/p&gt;

&lt;h3 id=&quot;19-探秘git目录&quot;&gt;1.9 探秘.git目录&lt;/h3&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;cd .git

ll -a

cat HEAD
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;ref: refs/heads/master&lt;/p&gt;

&lt;p&gt;.git 里的 HEAD 文件，说明目前工作的分支在 master。切换分支的话，HEAD 的内容会变化。 它说白了就是指当前的仓库工作在哪个分支上，是个引用。如果去编辑这个 HEAD 文件的话，其实就跟那个 git cheout 变换分支的命令是一样的。&lt;/p&gt;

&lt;p&gt;.git 里的 config 文件，跟本地仓库相关的配置文件都在这个里。&lt;/p&gt;

&lt;p&gt;.git 里的 refs 文件，包含有 heads 和 tags，意味着可以有很多很多标签的，有些书里也叫「里程碑」，heads 就是分支，说白了就是一个独立的开发空间，有些时候你要做前端的开发，有些时候你要做后端的开发， 那么就可以为前端建一个分支，为后端建一个分支，在各自的分支里工作，工作是互不影响的，当需要集成时，可以把 2 个分支集成到公共的分支上去。&lt;/p&gt;

&lt;p&gt;进入 heads 文件夹里，用命令查看 master 里的内容的对象，-t 就是看它的类型：&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;git cat-file -t 41f3867b0c6
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;返回的是&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;commit
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;使用命令：&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;git branch -av
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;通过结果可以看到，master 文件里存放的其实是指，我这个 master 的指针指向哪个 commit，它存放的是这样一个信息。&lt;/p&gt;

&lt;p&gt;.git 里的 objects 文件，里面有很多很多文件，比如进入文件夹「5d」里，把该文件名「5d」和里面的哈希值合并在一起，我们看看这个是个什么东西：&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;git cat-file -t 5dacd995d3dc21d6d5fcd669a8c40de7a58160d9
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;返回的是：&lt;/p&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;commit
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;git 仓库里有树「tree」的概念，跟 commit 是两种概念。&lt;/p&gt;

&lt;p&gt;看文件类型是「- t」，看内容的话是「- p」，那么：&lt;/p&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;git cat-file &lt;span class=&quot;nt&quot;&gt;-p&lt;/span&gt; 5dacd995d3dc21d6d5fcd669a8c40de7a58160d9
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;返回&lt;/p&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;tree 6a67d19d3d3119f3d48ef01d259560aeb64a147b
parent a926ba54cc5b24ba8f70ddac84f09a451145c1b2
author Landon100100 &amp;lt;129959392+Landon100100@users.noreply.github.com&amp;gt; 1704880273 +0800
committer Starry100100 &amp;lt;hxl100100@126.com&amp;gt; 1705036384 +0800

&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;git cat-file &lt;span class=&quot;nt&quot;&gt;-p&lt;/span&gt; 6a67d19d3d3119f3d48ef01d259560aeb64a147b
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;返回的结果，里面有 blob 类型的文件。&lt;/p&gt;

&lt;p&gt;到现在就出来了 git 核心的三类对象：commit、tree 和 blob。&lt;/p&gt;

&lt;p&gt;git 有个设定，只要任何文件的文件内容相同，在 git 眼里它就是唯一的一个 blob。&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;https://img-blog.csdnimg.cn/20200606091342778.png?x-oss-process=image/watermark,type_ZmFuZ3poZW5naGVpdGk,shadow_10,text_aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L3dlaXhpbl80MzkxNDYwNA==,size_16,color_FFFFFF,t_70&quot; alt=&quot;&quot; /&gt;&lt;/p&gt;

&lt;p&gt;先看左边的。一个 commit 肯定会对应一棵树 tree，不会对应 2 个的。这颗树代表了什么？我取出某个 commit，这个 commit 它对应着一个视图，这个视图里存放了一个快照，该快照集合里放了当前 commit 对应的本项目仓库所有的文件夹以及文件的快照。即，那个时间点，你这个文件夹是啥样，这个文件是啥样，它就是通过这个树呈现出来的。&lt;/p&gt;

&lt;p&gt;看中间的。我们这个树它前面的哈希值是 912fa6…我们可以看到，树里面包含树，blob 指的是具体的某个文件。&lt;/p&gt;

&lt;p&gt;1『树给我的感觉就是文件夹。』没有文件也就是没有 blob 对象的目录是不会被 git 管理的，因为 git 要对文件进行版本管理，所以没有必要对空目录生成对象。基于这一点，readme 文件的全路径是这样：[仓库根目录]/doc/readme。那么 tree 的数量与全路径中「/」的数量一致。git的commit就像一个文件系统，一次 commit 创建一棵大树，commit 是 root 节点。&lt;/p&gt;

&lt;p&gt;2『blob 跟文件名一点关系都没有，只要文件的内容相同，在 git 眼里，它就是一个文件，这个设计可节省空间。』&lt;/p&gt;

&lt;h2 id=&quot;二远程仓库&quot;&gt;二:远程仓库&lt;/h2&gt;

&lt;p&gt;以下这些都可以作为远程仓库.&lt;/p&gt;

&lt;p&gt;1.github&lt;/p&gt;

&lt;p&gt;2.gitlab&lt;/p&gt;

&lt;p&gt;3.gitee码云&lt;/p&gt;

&lt;p&gt;4.公司的机房里某一台服务器(电脑)&lt;/p&gt;

&lt;p&gt;5…..&lt;/p&gt;

&lt;h3 id=&quot;21-github-是什么&quot;&gt;2.1 github 是什么&lt;/h3&gt;

&lt;p&gt;https://github.com/&lt;/p&gt;

&lt;p&gt;1.是一个免费的远程仓库 (我们可以把我们写的代码存在这个网站里面)&lt;/p&gt;

&lt;p&gt;2.是一个代码托管平台,很多优秀的开源的项目都有放在github上,供大家学习/使用.&lt;/p&gt;

&lt;p&gt;3.自嘲:”全球最大的同性交友网站”&lt;/p&gt;

&lt;h3 id=&quot;22-github和git有关系吗&quot;&gt;2.2 github和git有关系吗?&lt;/h3&gt;

&lt;p&gt;没有,就是名字长得很像而已, 就像北大和北大某鸟的关系… 雷锋和雷峰塔….&lt;/p&gt;

&lt;p&gt;git是代码版本管理工具, 同样的工具还要svn等之类的.&lt;/p&gt;

&lt;p&gt;github是一个代码托管平台.同样的平台还有gitlab,码云gitee等….&lt;/p&gt;

&lt;h3 id=&quot;23-用github远程仓库托管代码使用步骤&quot;&gt;2.3 用github远程仓库托管代码使用步骤:&lt;/h3&gt;

&lt;p&gt;使用远程仓库有2种用法: 1: 新建一个空的远程仓库, 和已经存在的本地仓库取得关联 2: 新建一个非空的远程仓库, 克隆到本地, 克隆到本地的就是本地仓库&lt;/p&gt;

&lt;h4 id=&quot;231-第一种github新建一个空的远程仓库-关联已有的本地仓库&quot;&gt;2.3.1 第一种:gitHub新建一个空的远程仓库 关联已有的本地仓库&lt;/h4&gt;

&lt;p&gt;a. 新建远程仓库的时候, 下图Initialize this repository with a README那里不要打上勾.&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;https://mypicgo-1312526752.cos.ap-guangzhou.myqcloud.com/image/1565576306876.webp&quot; alt=&quot;img&quot; /&gt;&lt;/p&gt;

&lt;p&gt;b. 进去执行那两行命令.&lt;/p&gt;

&lt;div class=&quot;language-text highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;git remote add origin https://github.com/penglin0613/studyGit39_01.git
git push -u origin master
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;c. 完成后刷新远程仓库, 就有了之前本地提交的信息.&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;https://mypicgo-1312526752.cos.ap-guangzhou.myqcloud.com/image/1565576661052.webp&quot; alt=&quot;img&quot; /&gt;&lt;/p&gt;

&lt;p&gt;d.上面那句话就是让你去新建一个readMe.md文档, 用这个文档来介绍你的项目.&lt;/p&gt;

&lt;p&gt;e. 在本地建了一个readme.md文件, 通过git add.  git commit-m”” 提交到了本地仓库,  通过git push origin master推送到远程.&lt;/p&gt;

&lt;p&gt;术语：&lt;/p&gt;

&lt;p&gt;fast-forwards&lt;/p&gt;

&lt;p&gt;non fast-forwards&lt;/p&gt;

&lt;p&gt;提示不是fast-forwards时，代表commit树没有共同的祖先，这样是不允许push到远程的。&lt;/p&gt;

&lt;p&gt;本地时：&lt;/p&gt;

&lt;p&gt;解决方式1：可以通过 git merge 的方式合并分支，再git push到远程。&lt;/p&gt;

&lt;p&gt;解决方式2：通过git rebase。&lt;/p&gt;

&lt;p&gt;远程时：&lt;/p&gt;

&lt;p&gt;解决方式1：可以通过 git fetch 的方式获取远程分支，git merge的方式合并分支，再git push到远程。&lt;/p&gt;

&lt;p&gt;解决方式2：通过git pull合并分支，再git push到远程。&lt;/p&gt;

&lt;h4 id=&quot;232-第二种创建非空github仓库克隆到本地&quot;&gt;2.3.2 第二种:创建非空github仓库,克隆到本地&lt;/h4&gt;

&lt;p&gt;1.建立远程仓库&lt;/p&gt;

&lt;p&gt;​	1.1&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;https://mypicgo-1312526752.cos.ap-guangzhou.myqcloud.com/image/1561262281600.webp&quot; alt=&quot;img&quot; /&gt;&lt;/p&gt;

&lt;p&gt;​	1.2&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;https://mypicgo-1312526752.cos.ap-guangzhou.myqcloud.com/image/1561262574079.webp&quot; alt=&quot;img&quot; /&gt;&lt;/p&gt;

&lt;p&gt;2.把远程仓库克隆到本地&lt;/p&gt;

&lt;p&gt;​        2.1&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;https://mypicgo-1312526752.cos.ap-guangzhou.myqcloud.com/image/1561262641626.webp&quot; alt=&quot;img&quot; /&gt;&lt;/p&gt;

&lt;p&gt;​       2.2 复制一下这个远程仓库的地址&lt;/p&gt;

&lt;p&gt;​       2.3  来到   本地你需要把这个仓库 放到所在地 的文件夹.  右键点击git bash here&lt;/p&gt;

&lt;p&gt;​           命令:  git clone 仓库地址&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;https://mypicgo-1312526752.cos.ap-guangzhou.myqcloud.com/image/1561262803439.webp&quot; alt=&quot;img&quot; /&gt;&lt;/p&gt;

&lt;p&gt;​           &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;git clone 仓库地址&lt;/code&gt;，只能克隆仓库地址&lt;/p&gt;

&lt;p&gt;​			出现了done就说明克隆完成,  在当前文件夹就会出现一个和远程仓库名字一毛一样的一个文件夹.&lt;/p&gt;

&lt;p&gt;​&lt;/p&gt;

&lt;p&gt;​			&lt;strong&gt;拉取分支&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;​			&lt;strong&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;git fetch origin develop:develop&lt;/code&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;3.在本地编码&lt;/p&gt;

&lt;ol&gt;
  &lt;li&gt;add  commit  提交到本地仓库 注意啦: 编码提交到本地,一定要进入到这个文件夹中去. 再右键点击git gitHub here 出来小黑框&lt;/li&gt;
  &lt;li&gt;推送到远程仓库 命令: git push origin master&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;出现了这个done就说明ok了.&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;https://mypicgo-1312526752.cos.ap-guangzhou.myqcloud.com/image/1561263091289.webp&quot; alt=&quot;&quot; /&gt;&lt;/p&gt;

&lt;h3 id=&quot;24-如何删除github仓库&quot;&gt;2.4 如何删除gitHub仓库&lt;/h3&gt;

&lt;p&gt;a.找到你要删除的库.&lt;/p&gt;

&lt;p&gt;b.点击&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Settings&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;./assets/1561272517355.webp&quot; alt=&quot;img&quot; /&gt;&lt;/p&gt;

&lt;p&gt;c.&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;https://mypicgo-1312526752.cos.ap-guangzhou.myqcloud.com/image/1561272716261.webp&quot; alt=&quot;img&quot; /&gt;&lt;/p&gt;

&lt;p&gt;d.&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;https://mypicgo-1312526752.cos.ap-guangzhou.myqcloud.com/image/1561272756238.webp&quot; alt=&quot;img&quot; /&gt;&lt;/p&gt;

&lt;p&gt;e.&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;https://mypicgo-1312526752.cos.ap-guangzhou.myqcloud.com/image/1561272811049.webp&quot; alt=&quot;img&quot; /&gt;&lt;/p&gt;

&lt;h3 id=&quot;25-github的搜索与高级搜索search-advance&quot;&gt;2.5 github的搜索与高级搜索（search advance）&lt;/h3&gt;

&lt;p&gt;比较常用，&lt;strong&gt;搜索仓库&lt;/strong&gt;和&lt;strong&gt;搜索代码&lt;/strong&gt;。&lt;/p&gt;

&lt;h4 id=&quot;高级搜索&quot;&gt;高级搜索&lt;/h4&gt;

&lt;ul&gt;
  &lt;li&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;create:&amp;lt;2024-03-01&lt;/code&gt; &lt;strong&gt;创建在 2024-03-01日之前的仓库，&amp;lt;2024-03-01&lt;/strong&gt;&lt;/li&gt;
  &lt;li&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;git 最好 学习 资料 in:readme&lt;/code&gt; 表示：搜索 git 仓库，项目 README 文件描述有关键字为‘最好 学习 资料’ &lt;strong&gt;所以自己的项目 README 文件一定要认真写&lt;/strong&gt;&lt;/li&gt;
  &lt;li&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;git 最好 学习 资料 in:readme stars:&amp;gt;1000&lt;/code&gt; 代表必须大于 1000 个 Star 的项目仓库 更多操作可以在 Advanced search 里填写设置之后再搜索&lt;/li&gt;
  &lt;li&gt;‘after_script:’+’stage:deploy’ filename:.gitlab-ci.yml 搜索.gitlab-ci.yml 文件中包含‘after_script:’和‘stage:deploy’代码的仓库，根据 filename 进行搜索只会根据代码的内容来搜索，只会搜出代码&lt;/li&gt;
  &lt;li&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;blog easily start in:readme stars:&amp;gt;5000&lt;/code&gt; 搜索搭建博客的仓库，且星级超过 5000 个&lt;/li&gt;
  &lt;li&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;in:name React&lt;/code&gt; 搜索项目名里面包含 React 的项目&lt;/li&gt;
  &lt;li&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;in:name React stars:500..5000&lt;/code&gt; 精确到项目的 star 数在500~4000&lt;/li&gt;
  &lt;li&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;in:name React stars:&amp;gt;5000 forks:&amp;gt;3000&lt;/code&gt; 按照 fork 的数量来进行搜索&lt;/li&gt;
  &lt;li&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;in:readme React&lt;/code&gt; 按照 README 来搜索 README.md 里面包含 React 的项目&lt;/li&gt;
  &lt;li&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Vue in:readme stars:&amp;gt;3000 forks:&amp;gt;3000&lt;/code&gt; 限制一下它的 star 数和 fork 数&lt;/li&gt;
  &lt;li&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;in:description 微服务&lt;/code&gt; 按照 descriptin 搜索微服务项目&lt;/li&gt;
  &lt;li&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;in:description 微服务 language:JavaScript&lt;/code&gt; 增加一些筛选条件,把语言限制为 python&lt;/li&gt;
  &lt;li&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;in:description 微服务 language:JavaScript pushed:&amp;gt;2023-09-01&lt;/code&gt; pushed:&amp;gt;2023-09-01 的意思是我们把项目的最后更新时间大于 2023-09-01&lt;/li&gt;
&lt;/ul&gt;

&lt;h3 id=&quot;2-6git辅助工具了解即可&quot;&gt;2. 6git辅助工具(了解即可)&lt;/h3&gt;

&lt;p&gt;先学会使用命令, 图形化工具一点就通&lt;/p&gt;

&lt;h4 id=&quot;261-vscode自带的小黑框-终端&quot;&gt;2.6.1 vscode自带的小黑框-终端&lt;/h4&gt;

&lt;p&gt;a. vscode自带小黑框(终端)&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;https://mypicgo-1312526752.cos.ap-guangzhou.myqcloud.com/image/1561263411725.webp&quot; alt=&quot;&quot; /&gt;&lt;/p&gt;

&lt;p&gt;b.注意,一定要注意路径的问题,  一定要是在git管理的那个文件夹下.&lt;/p&gt;

&lt;h4 id=&quot;262-vscode自带了一个不用写命令的工具&quot;&gt;2.6.2 vscode自带了一个不用写命令的工具&lt;/h4&gt;

&lt;p&gt;&lt;img src=&quot;https://mypicgo-1312526752.cos.ap-guangzhou.myqcloud.com/image/1561263961785.webp&quot; alt=&quot;img&quot; /&gt;&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;a. 选中你要add的文件, 点加号,  就相当于git add .
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;b. 点击勾勾√  , 就相当于  git commit -m””&lt;/p&gt;

&lt;p&gt;c. 点击…后,选择推送  ,  就相当于是git push&lt;/p&gt;

&lt;h4 id=&quot;263-像vscode自带的git这样不用写命令的工具有很多种&quot;&gt;2.6.3 像vscode自带的git这样不用写命令的工具有很多种.&lt;/h4&gt;

&lt;p&gt;TortoiseGit  小乌龟&lt;/p&gt;

&lt;p&gt;sourceTree&lt;/p&gt;

&lt;p&gt;GitHubDeskTop  小紫猫/章鱼猫&lt;/p&gt;

&lt;h4 id=&quot;264-git自带的guigitk&quot;&gt;2.6.4 git自带的gui——gitk。&lt;/h4&gt;

&lt;p&gt;windows系统需设置编码格式，解决中文乱码。&lt;/p&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;git config &lt;span class=&quot;nt&quot;&gt;--global&lt;/span&gt; gui.encodeing utf-8
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;gitk打开&lt;/p&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;gitk
gitk &lt;span class=&quot;nt&quot;&gt;--all&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;比较两个分支（或版本号）&lt;/p&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;c&quot;&gt;# git diff 旧版本哈希值 新版本哈希值 &lt;/span&gt;

git diff HEAD^ HEAD	&lt;span class=&quot;c&quot;&gt;# 最近一次提交对比上一次提交的差异&lt;/span&gt;

git diff &lt;span class=&quot;nt&quot;&gt;--cached&lt;/span&gt;	&lt;span class=&quot;c&quot;&gt;# 比较暂存区和HEAD的差异&lt;/span&gt;
git diff			&lt;span class=&quot;c&quot;&gt;# 比较工作区和暂存区的差异&lt;/span&gt;
git diff &lt;span class=&quot;nt&quot;&gt;--&lt;/span&gt; &amp;lt;file&amp;gt;	&lt;span class=&quot;c&quot;&gt;# 比较工作区和暂存区的某个文件的差异&lt;/span&gt;


&lt;span class=&quot;c&quot;&gt;# 比较master与bugfix_css，并发现对 index.html 感兴趣。&lt;/span&gt;
git diff bugfix_css master &lt;span class=&quot;nt&quot;&gt;--&lt;/span&gt; index.html

&lt;span class=&quot;c&quot;&gt;# 或者&lt;/span&gt;
git branch &lt;span class=&quot;nt&quot;&gt;-av&lt;/span&gt;
&lt;span class=&quot;c&quot;&gt;# 拿到两个分支的最近一次的commit哈希值，再比较&lt;/span&gt;
git diff 5bf3fd1 03a5c53 &lt;span class=&quot;nt&quot;&gt;--&lt;/span&gt; index.html
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h2 id=&quot;三git分支-branch&quot;&gt;三:git分支 branch&lt;/h2&gt;

&lt;p&gt;我们现在写代码,都是写在一个默认的主分支(master)里,这样其实是不对的.&lt;/p&gt;

&lt;p&gt;master分支的代码一定是能运行的代码,一般这个分支用来发布版本.&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;https://mypicgo-1312526752.cos.ap-guangzhou.myqcloud.com/image/1561338866718.webp&quot; alt=&quot;img&quot; /&gt;&lt;/p&gt;

&lt;h4 id=&quot;31-使用-步骤&quot;&gt;3.1 使用 步骤&lt;/h4&gt;

&lt;p&gt;a.新建仓库,就会有一个默认的master分支.&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;https://mypicgo-1312526752.cos.ap-guangzhou.myqcloud.com/image/1561339241353.webp&quot; alt=&quot;img&quot; /&gt;&lt;/p&gt;

&lt;p&gt;b.新建分支   git branch 分支名&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;https://mypicgo-1312526752.cos.ap-guangzhou.myqcloud.com/image/1561339303968.webp&quot; alt=&quot;img&quot; /&gt;&lt;/p&gt;

&lt;p&gt;c.切换到分支写代码,切换分支  git checkout 分支名&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;https://mypicgo-1312526752.cos.ap-guangzhou.myqcloud.com/image/1561339368113.webp&quot; alt=&quot;img&quot; /&gt;&lt;/p&gt;

&lt;p&gt;d.在新分支上编码, 编码后 add commit , 提交到新分支&lt;/p&gt;

&lt;p&gt;e.切回到主分支后合并新分支   git merge 分支名&lt;/p&gt;

&lt;div class=&quot;language-text highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;注意:要回到主分支再合并
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;f.删除新分支   git branch -d 分支名&lt;/p&gt;

&lt;p&gt;​	注意:回到主分支再删除次分支&lt;/p&gt;

&lt;p&gt;g.补充: git branch  查看分支&lt;/p&gt;

&lt;p&gt;​         git checkout -b 分支名   新建并切换分支&lt;/p&gt;

&lt;p&gt;​		  git checkout -b 新分支 旧分支。（如 git checkout -b feat/162281 origin/master） 基于旧分支新建并切换分支。&lt;/p&gt;

&lt;h4 id=&quot;32-工作中的分支使用记忆&quot;&gt;3.2 工作中的分支使用(记忆)&lt;/h4&gt;

&lt;p&gt;​	新建仓库就有一个默认的master主分支&lt;/p&gt;

&lt;p&gt;a. 主分支（master），一定是不能直接在上面写代码的&lt;/p&gt;

&lt;p&gt;​	master 上面的代码一定时没有问题，可以运行起来的，master分支上的代码一般用来做上线，做版本发布&lt;/p&gt;

&lt;p&gt;b.写代码一定有一个开发分支（dev）&lt;/p&gt;

&lt;p&gt;​	一定是没有问题的代码才合并到master分支上&lt;/p&gt;

&lt;p&gt;c.工作中分支有的是一人一个，也有的是大家公用一个。&lt;/p&gt;

&lt;h2 id=&quot;四git-pull&quot;&gt;四:git pull&lt;/h2&gt;

&lt;p&gt;&lt;img src=&quot;https://mypicgo-1312526752.cos.ap-guangzhou.myqcloud.com/image/1606206009973.webp&quot; alt=&quot;img&quot; /&gt;&lt;/p&gt;

&lt;h2 id=&quot;五git-工作图解&quot;&gt;五:git 工作图解&lt;/h2&gt;

&lt;p&gt;&lt;img src=&quot;https://mypicgo-1312526752.cos.ap-guangzhou.myqcloud.com/image/1581158463446.webp&quot; alt=&quot;img&quot; /&gt;&lt;/p&gt;

&lt;h2 id=&quot;六制作github个人主页了解&quot;&gt;六:制作github个人主页(了解)&lt;/h2&gt;

&lt;p&gt;&lt;img src=&quot;https://mypicgo-1312526752.cos.ap-guangzhou.myqcloud.com/image/1561273343450.webp&quot; alt=&quot;img&quot; /&gt;&lt;/p&gt;

&lt;p&gt;把这个新建的库克隆到本地&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;https://mypicgo-1312526752.cos.ap-guangzhou.myqcloud.com/image/1561273420643.webp&quot; alt=&quot;img&quot; /&gt;&lt;/p&gt;

&lt;p&gt;这个文件夹里面一定要有一个index.html页面&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;https://mypicgo-1312526752.cos.ap-guangzhou.myqcloud.com/image/1561273674764.webp&quot; alt=&quot;img&quot; /&gt;&lt;/p&gt;

&lt;p&gt;注意:&lt;/p&gt;

&lt;p&gt;​       不要往这个个人主页这个文件夹里面丢java,c#等其他的后端语言的代码.&lt;/p&gt;

&lt;p&gt;​       不要丢之前写的图灵的聊天机器人&lt;/p&gt;

&lt;h2 id=&quot;七回顾&quot;&gt;七:回顾&lt;/h2&gt;

&lt;h3 id=&quot;71-基本命令&quot;&gt;7.1 基本命令&lt;/h3&gt;

&lt;p&gt;git add .        添加到暂存区&lt;/p&gt;

&lt;p&gt;git commit -m’描述信息’     提交到本地仓库&lt;/p&gt;

&lt;p&gt;git commit –amend 	修改最近一次的提交的message&lt;/p&gt;

&lt;p&gt;git status     查看状态&lt;/p&gt;

&lt;p&gt;​	  未加到暂存区是红色的.&lt;/p&gt;

&lt;p&gt;​      已经加到暂存区是绿色的.&lt;/p&gt;

&lt;p&gt;​      已经提交了  nothing&lt;/p&gt;

&lt;p&gt;git log         查看日志&lt;/p&gt;

&lt;p&gt;​      如果卡住了就按q退出&lt;/p&gt;

&lt;p&gt;git log –oneline   查看一行的日志&lt;/p&gt;

&lt;p&gt;git log –graph		查看当前分支的图形日志&lt;/p&gt;

&lt;p&gt;git log –all –graph 查看所有分支的图形日志&lt;/p&gt;

&lt;p&gt;git reflog  查看所有日志(包括回滚的日志)&lt;/p&gt;

&lt;h3 id=&quot;72-远程仓库&quot;&gt;7.2 远程仓库&lt;/h3&gt;

&lt;p&gt;git remote        查看远程仓库名字&lt;/p&gt;

&lt;p&gt;git remote -v    查看远程仓库地址&lt;/p&gt;

&lt;p&gt;git remote remove origin   取消和远程仓库之间的连接.&lt;/p&gt;

&lt;h4 id=&quot;721-空仓库&quot;&gt;7.2.1 空仓库&lt;/h4&gt;

&lt;p&gt;git remote add origin 远程仓库地址      空仓库和已有的本地仓库建立连接 （默认命名为origin，也可 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;git remote add github 远程仓库地址&lt;/code&gt;）&lt;/p&gt;

&lt;p&gt;git push -u origin master   把本地仓库代码推送到远程&lt;/p&gt;

&lt;h4 id=&quot;722-非空仓库&quot;&gt;7.2.2 非空仓库&lt;/h4&gt;

&lt;p&gt;git clone 远程仓库地址     克隆远程仓库,只会克隆master分支.&lt;/p&gt;

&lt;p&gt;git push origin –all 如git push github –all&lt;/p&gt;

&lt;p&gt;可能遇到push main时会冲突，此时fetch远程仓库，然后merge，之后再push即可解决。&lt;/p&gt;

&lt;p&gt;git checkout 分支名         把远程仓库的某个分支拉取到本地&lt;/p&gt;

&lt;p&gt;推送非空仓库遇到冲突。&lt;/p&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;git push github &lt;span class=&quot;nt&quot;&gt;--all&lt;/span&gt;
To github.com:Landon100100/git-geek.git
 &lt;span class=&quot;o&quot;&gt;!&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;rejected]        main -&amp;gt; main &lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;fetch first&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt;
error: failed to push some refs to &lt;span class=&quot;s1&quot;&gt;'github.com:Landon100100/git-geek.git'&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;git fetch origin 分支
&lt;span class=&quot;c&quot;&gt;# 或git fetch github main&lt;/span&gt;
git checkout main
&lt;span class=&quot;c&quot;&gt;# git merge github/main # fatal: refusing to merge unrelated histories&lt;/span&gt;
git merge &lt;span class=&quot;nt&quot;&gt;--allow-unrelated-histories&lt;/span&gt; github/main
&lt;span class=&quot;c&quot;&gt;# gitk --all&lt;/span&gt;
git push github main
&lt;span class=&quot;c&quot;&gt;# git --all # 可观察到main分支有两个parent&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h3 id=&quot;73-分支&quot;&gt;7.3 分支&lt;/h3&gt;

&lt;p&gt;git branch         查看分支&lt;/p&gt;

&lt;p&gt;git branch -v 	查看分支名、版本号及提交commit&lt;/p&gt;

&lt;p&gt;git branch  分支名          新建分支&lt;/p&gt;

&lt;p&gt;git checkout 分支名        切换分支&lt;/p&gt;

&lt;p&gt;git checkout -b 分支名     新建并切换分支&lt;/p&gt;

&lt;p&gt;git merge 分支名          把分支合并到当前分支&lt;/p&gt;

&lt;p&gt;git merge –continue		解决完冲突后，继续完成merge&lt;/p&gt;

&lt;p&gt;git branch -d 分支名    删除本地分支&lt;/p&gt;

&lt;p&gt;git push -u origin master      远程有master分支,把代码推到远程master&lt;/p&gt;

&lt;p&gt;git push –set-upstream origin dev      远程没有dev分支, 把本地dev分支的代码推送到远程dev&lt;/p&gt;

&lt;p&gt;git push origin dev     远程有dev分支,把dev分支的代码推送到远程dev分支.&lt;/p&gt;

&lt;p&gt;git push     简写,把当前分支推送到远程当前名字分支.&lt;/p&gt;

&lt;p&gt;git push origin –delete 分支名      删除远程分支.&lt;/p&gt;

&lt;p&gt;git push origin  :分支名                   删除远程分支(推送一个空的分支来替换远程分支)&lt;/p&gt;

&lt;h3 id=&quot;74-git-pull&quot;&gt;7.4 git pull&lt;/h3&gt;

&lt;p&gt;git pull origin dev     把远程dev和本地不一样的拉取到本地dev. (包含fetch和merge)&lt;/p&gt;

&lt;h4 id=&quot;742&quot;&gt;7.4.2&lt;/h4&gt;

&lt;p&gt;git cat-file -t 哈希值   		查看内容的类型（如commit、tree、blob、tag等） 举例，  3a/7bbaa95a7aee4c1209a6b029dbf8184b995302，去掉’/’，即&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;git cat-file -t 3a7bbaa95&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;git cat-file -p 哈希值   		查看版本库对象（如文件）的内容&lt;/p&gt;

&lt;p&gt;git cat-file -s 哈希值			查看版本库对象的大小（单位：字节，B）&lt;/p&gt;

&lt;h3 id=&quot;75-git-rebase&quot;&gt;7.5 git rebase&lt;/h3&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;git rebase &lt;span class=&quot;nt&quot;&gt;-i&lt;/span&gt; 修改的版本哈希值的前一个
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;div class=&quot;language-markdown highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;p (pick) 保留： 保留提交不变。
r (reword) 修改： 保留提交，但编辑其提交信息。
e (edit) 编辑： 保留提交，但暂停以进行手动更改。
s (squash) 合并： 将提交与前一个提交合并。
f (fixup) 修正： 类似于 &quot;squash&quot;，但丢弃提交的提交信息。
x (exec) 执行： 运行一个 shell 命令。
d (drop) 删除： 删除提交。
b (break) 暂停： 暂停变基以便以后继续。
l (label) 标记： 为当前 HEAD 分配一个标签。
t (reset) 重置： 将 HEAD 重置为标签。
m (merge) 合并： 在变基过程中创建合并提交。
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;细节：如果从根提交（第一个提交）变基。方式1：手动复制根提交的commit哈希值，再敲&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;git rebase -i 根提交哈希值&lt;/code&gt;，在弹出的编辑器手动添加&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;pick 根commit的id 描述&lt;/code&gt;。方式2：&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;git rebase -i --root&lt;/code&gt;，允许变基根提交。&lt;/p&gt;

&lt;p&gt;操作步骤：&lt;/p&gt;

&lt;ol&gt;
  &lt;li&gt;&lt;strong&gt;编辑提交列表：&lt;/strong&gt; 根据需要更改操作命令。&lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;保存并退出：&lt;/strong&gt; 保存文件以启动重基。&lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;解决冲突：&lt;/strong&gt; 解决任何出现的冲突。&lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;继续或中止：&lt;/strong&gt; 使用 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;git rebase --continue&lt;/code&gt; 继续或使用 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;git rebase --abort&lt;/code&gt; 停止。&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;成功了会提示 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Successfully rebased and updated refs/heads/分支名&lt;/code&gt;，如&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Successfully rebased and updated refs/heads/master&lt;/code&gt;。&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;如何修改老旧的 commit 的 message?&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;例子1：&lt;/p&gt;

&lt;p&gt;修改某一个commit，选择它的父亲作为变基。&lt;/p&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;git rebase &lt;span class=&quot;nt&quot;&gt;-i&lt;/span&gt; 父tree的哈希值
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;编辑器（vim）编辑&lt;/p&gt;

&lt;div class=&quot;language-markdown highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;r 4292430 refering projects
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;使用&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;:wq&lt;/code&gt;保存后。&lt;/p&gt;

&lt;p&gt;再用编辑器（vim）编辑&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;Add a refering project
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;使用&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;:wq&lt;/code&gt;保存。&lt;/p&gt;

&lt;p&gt;例子2：&lt;/p&gt;

&lt;p&gt;把4个commit，合并成一个。第1个使用默认的pick，可以对第2-4个使用 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;s&lt;/code&gt;。并编辑新提交的commit信息。&lt;/p&gt;

&lt;p&gt;完成后，commit哈希值会变化，它后面的commit哈希值也会变化。&lt;/p&gt;

&lt;h5 id=&quot;合并几个不连续的commit&quot;&gt;合并几个不连续的commit。&lt;/h5&gt;

&lt;p&gt;需要调整顺序，把需合并的commit，移动到待合并的commit的下一行，并将pick改为&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;s&lt;/code&gt;。&lt;/p&gt;

&lt;p&gt;提示：如果用到第一个提交，而它没有parent，则将第一个的commit添加到第1行。（假设commit哈希值为 f09122c）&lt;/p&gt;

&lt;div class=&quot;language-markdown highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;pick f09122c
...
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;&lt;strong&gt;把暂存区恢复成和 HEAD 一样？&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;如果撤销工作区的内容，使用 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;git checkout -- &amp;lt;file&amp;gt;&lt;/code&gt;；如果 撤销暂存区的内容，使用&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;git reset HEAD &amp;lt;file&amp;gt;&lt;/code&gt;；。也就是说，如果想变更工作区的内容，找checkout；如果想变暂存区，找 reset。&lt;/p&gt;

&lt;p&gt;另外，现在新增加了 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;git restore&lt;/code&gt;命令。使用”git restore &lt;file&gt;...&quot;撤销工作区的内容；使用&quot;git add &lt;file&gt;...&quot;撤销暂存区的内容。&lt;/file&gt;&lt;/file&gt;&lt;/p&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;git reset HEAD

git diff &lt;span class=&quot;nt&quot;&gt;--cached&lt;/span&gt; &lt;span class=&quot;c&quot;&gt;# 没有返回内容，代表两个内容相同&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;把暂存区部分文件恢复成和 HEAD 一样？&lt;/p&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;git reset HEAD &lt;span class=&quot;nt&quot;&gt;--&lt;/span&gt; style/style.css
git reset HEAD &lt;span class=&quot;nt&quot;&gt;--&lt;/span&gt; style/style.css

git status &lt;span class=&quot;c&quot;&gt;# 查看状态&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;把暂存区和工作区文件恢复成和 HEAD 一样？&lt;/p&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;git reset &lt;span class=&quot;nt&quot;&gt;--hard&lt;/span&gt; HEAD
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;&lt;strong&gt;把工作区恢复成暂存区一样？&lt;/strong&gt;&lt;/p&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;git checkout &lt;span class=&quot;nt&quot;&gt;--&lt;/span&gt; &amp;lt;file&amp;gt;

git checkout &lt;span class=&quot;nt&quot;&gt;--&lt;/span&gt; index.html &lt;span class=&quot;c&quot;&gt;# 将工作区恢复成和暂存区一样&lt;/span&gt;

git diff &lt;span class=&quot;nt&quot;&gt;--&lt;/span&gt; index.html
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h5 id=&quot;752-临时存储&quot;&gt;7.5.2 临时存储&lt;/h5&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;git stash

&lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;git stash list
stash@&lt;span class=&quot;o&quot;&gt;{&lt;/span&gt;0&lt;span class=&quot;o&quot;&gt;}&lt;/span&gt;: WIP on master: a926ba5 recover readme.md

git stash apply
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;git stash apply与 git stash pop的区别：两者都是将临时存储的恢复过来，其中apply仍保留原来的那条记录，而pop不保留原来的那条记录。&lt;/p&gt;

&lt;h3 id=&quot;76-撤销更改&quot;&gt;7.6 撤销更改&lt;/h3&gt;

&lt;h4 id=&quot;761-没有提交到暂存区&quot;&gt;7.6.1 没有提交到暂存区&lt;/h4&gt;

&lt;p&gt;git checkout index.html     撤销更改&lt;/p&gt;

&lt;h4 id=&quot;762-已经提交到暂存区了&quot;&gt;7.6.2 已经提交到暂存区了&lt;/h4&gt;

&lt;p&gt;git reset HEAD index.html   撤销add提交&lt;/p&gt;

&lt;p&gt;git checkout index.html      撤销更改&lt;/p&gt;

&lt;h4 id=&quot;763-删除暂存区中的文件&quot;&gt;7.6.3 删除暂存区中的文件&lt;/h4&gt;

&lt;p&gt;git rm –cached  文件名   将文件从暂存区中删除&lt;/p&gt;

&lt;h3 id=&quot;77-版本回滚穿梭&quot;&gt;7.7 版本回滚(穿梭)&lt;/h3&gt;

&lt;p&gt;git reset –hard 版本号        版本号就是log出来的黄色一串字符,可以是任意的版本号.&lt;/p&gt;

&lt;p&gt;git reset –hard HEAD^       上一个版本 （&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;git reset --hard&lt;/code&gt; 缺省是回滚到上一个版本）&lt;/p&gt;

&lt;p&gt;git reset –hard HEAD^^     上 上一个版本&lt;/p&gt;

&lt;p&gt;git reset –hard HEAD~3 	上三个版本&lt;/p&gt;

&lt;p&gt;git reset –hard 版本哈希值	回滚到某一个指定版本，即删除最近的几次commit，或工作区和暂存区恢复到指定的 commit&lt;/p&gt;

&lt;h3 id=&quot;78-配置邮箱和用户名&quot;&gt;7.8 配置邮箱和用户名&lt;/h3&gt;

&lt;h4 id=&quot;781-查看邮箱和用户名&quot;&gt;7.8.1 查看邮箱和用户名&lt;/h4&gt;

&lt;p&gt;git config user.email&lt;/p&gt;

&lt;p&gt;git config &lt;a href=&quot;http://user.name&quot;&gt;user.name&lt;/a&gt;&lt;/p&gt;

&lt;h4 id=&quot;782-设置&quot;&gt;7.8.2 设置&lt;/h4&gt;

&lt;p&gt;git config –global user.email  ‘邮箱名’&lt;/p&gt;

&lt;p&gt;git config –global &lt;a href=&quot;http://user.name&quot;&gt;user.name&lt;/a&gt;  ‘你的用户名’&lt;/p&gt;

&lt;h3 id=&quot;79-暂时保存&quot;&gt;7.9 暂时保存&lt;/h3&gt;

&lt;p&gt;git stash  把暂存区中的保存到缓存中.&lt;/p&gt;

&lt;p&gt;git stash list 查看缓存（临时存储）的列表&lt;/p&gt;

&lt;p&gt;git stash pop  	从缓存中取出来，并删除第1个&lt;/p&gt;

&lt;p&gt;git stash apply	从缓存中取出来，且不删除第1个&lt;/p&gt;

&lt;h3 id=&quot;710-多人合作的项目&quot;&gt;7.10 多人合作的项目&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;不同人修改了不同文件如何处理？&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;假设有A、B两位开发者，他们都在这个新的分支下工作，修改不同的文件，A修改 readme.md 文件，B修改 index.html 文件并最后进行提交，同步到 github 上。出现的场景：B先push到远程，A后push到远程。A会出现&lt;/p&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt; &lt;span class=&quot;o&quot;&gt;!&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;rejected]        feature/add_git_commands -&amp;gt; feature/add_git_commands &lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;fetch first&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt;
error: failed to push some refs to &lt;span class=&quot;s1&quot;&gt;'github.com:Landon100100/git-geek.git'&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;A的解决方法1：&lt;/p&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;git fetch
&lt;span class=&quot;c&quot;&gt;# git merge 远程分支&lt;/span&gt;
git merge github/feature/add_git_commands
&lt;span class=&quot;c&quot;&gt;# git push 远程名 # 远程名缺省值为origin，它为origin时可省略&lt;/span&gt;
git push github
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;A的解决方法2：&lt;/p&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;git pull
git push github
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;&lt;strong&gt;不同人修改了同文件的不同区域如何处理？&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;假设 B和 A同时修改了 index.html 文件的不同区域&lt;/p&gt;

&lt;p&gt;先 B修改 index.html 后 push, 这时 A正在本地修改 index.html，A不知道 B已经修改了而且 push 了，这里 A进行 push 就会报错，必须合并才可以 push, 而且合并之后，A可以看见 index.html 内容变了，加了 B添加的内容。&lt;/p&gt;

&lt;p&gt;与&lt;strong&gt;不同人修改了不同文件如何处理？&lt;/strong&gt;的操作相同。&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;不同人修改了同文件的相同区域如何处理？&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;git merge 时，提示出现了冲突。&lt;/p&gt;

&lt;p&gt;处理冲突。其中 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&lt;/code&gt;代表当前分支修改的，&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;=======&lt;/code&gt;代表分隔，&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&lt;/code&gt;代表导入分支修改的。&lt;/p&gt;

&lt;p&gt;处理完后，再&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;git push&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;在远程分支查看是否成功&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;多人同时修改了文件名怎么处理&lt;/strong&gt;&lt;/p&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;git &lt;span class=&quot;nb&quot;&gt;mv &lt;/span&gt;原文件名 新文件名
git add 文件名
git commit &lt;span class=&quot;nt&quot;&gt;-m&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;'描述信息'&lt;/span&gt;
git push
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;git会对文件名智能感知。&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;同时变更了文件名和文件内容如何处理？&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;同”合并冲突”。&lt;/p&gt;

&lt;p&gt;团队协作中，git的禁止事项：&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;禁止向集成分支执行 push -f 操作&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;禁止向集成分支执行变更历史的操作&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;如禁止在集成分支中，进行&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;git rebase&lt;/code&gt;&lt;/p&gt;

&lt;h3 id=&quot;711-设置公钥&quot;&gt;7.11 设置公钥&lt;/h3&gt;

&lt;p&gt;&lt;a href=&quot;https://gitee.com/help/articles/4191&quot;&gt;设置公钥&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;712-忽略文件&quot;&gt;7.12 忽略文件&lt;/h3&gt;

&lt;p&gt;新建一个 .gitignore 文件, 把需要忽略的文件和文件夹写在这里&lt;/p&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;c&quot;&gt;# 忽略文件&lt;/span&gt;
doc

&lt;span class=&quot;c&quot;&gt;# 忽略文件夹。后面加/,表示文件夹&lt;/span&gt;
doc/
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h3 id=&quot;713-readmemd&quot;&gt;7.13 &lt;a href=&quot;http://readme.md&quot;&gt;readme.md&lt;/a&gt;&lt;/h3&gt;

&lt;p&gt;给仓库添加说明&lt;/p&gt;

&lt;h3 id=&quot;714-裸仓库&quot;&gt;7.14 裸仓库&lt;/h3&gt;

&lt;p&gt;常用的传输协议&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;https://img-blog.csdnimg.cn/20200606202058463.png?x-oss-process=image/watermark,type_ZmFuZ3poZW5naGVpdGk,shadow_10,text_aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L3dlaXhpbl80MzkxNDYwNA==,size_16,color_FFFFFF,t_70&quot; alt=&quot;&quot; /&gt;&lt;/p&gt;

&lt;p&gt;裸仓库是一种没有工作目录的Git仓库，它只包含.git目录，用于存储版本历史和元数据信息。裸仓库通常用于集中管理代码，并作为团队成员之间协作的中心仓库。&lt;/p&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;git clone &lt;span class=&quot;nt&quot;&gt;--bare&lt;/span&gt; &amp;lt;源仓库URL&amp;gt; &amp;lt;目标目录&amp;gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;例如，如果您想要克隆一个名为myrepo的仓库的裸仓库到本地，您可以执行以下命令：&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;git clone --bare https://github.com/user/myrepo.git myrepo.git
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h2 id=&quot;八补充几个连接&quot;&gt;八:补充几个连接:&lt;/h2&gt;

&lt;p&gt;&lt;a href=&quot;https://www.liaoxuefeng.com/wiki/896043488029600/896067008724000&quot;&gt;廖雪峰讲git&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://www.liaoxuefeng.com/wiki/1022910821149312&quot;&gt;廖雪峰讲js&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;http://www.ruanyifeng.com/blog/2015/12/git-cheat-sheet.html&quot;&gt;阮一峰常用 Git 命令清单&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;http://www.ruanyifeng.com/blog/2015/07/flex-examples.html&quot;&gt;阮一峰Flex 布局教程&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;http://es6.ruanyifeng.com/&quot;&gt;阮一峰ES6 入门教程&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://juejin.cn/post/6844904166867861511&quot;&gt;Git 可以这么学&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://git-scm.com/book/zh/v2/起步-关于版本控制&quot;&gt;git官方手册&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;https://www.bilibili.com/video/BV1hf4y1L7LC/&lt;/p&gt;

&lt;h2 id=&quot;今日单词&quot;&gt;今日单词&lt;/h2&gt;

&lt;ul&gt;
  &lt;li&gt;
    &lt;table&gt;
      &lt;thead&gt;
        &lt;tr&gt;
          &lt;th&gt;单词&lt;/th&gt;
          &lt;th&gt;解释&lt;/th&gt;
          &lt;th&gt;说明&lt;/th&gt;
        &lt;/tr&gt;
      &lt;/thead&gt;
      &lt;tbody&gt;
        &lt;tr&gt;
          &lt;td&gt;Git&lt;/td&gt;
          &lt;td&gt; &lt;/td&gt;
          &lt;td&gt;Git版本管理&lt;/td&gt;
        &lt;/tr&gt;
        &lt;tr&gt;
          &lt;td&gt;svn&lt;/td&gt;
          &lt;td&gt; &lt;/td&gt;
          &lt;td&gt;svn版本管理&lt;/td&gt;
        &lt;/tr&gt;
        &lt;tr&gt;
          &lt;td&gt;github&lt;/td&gt;
          &lt;td&gt;全球的远程仓库&lt;/td&gt;
          &lt;td&gt;远程仓库&lt;/td&gt;
        &lt;/tr&gt;
        &lt;tr&gt;
          &lt;td&gt;Bash&lt;/td&gt;
          &lt;td&gt;进入子程序&lt;/td&gt;
          &lt;td&gt;Git Bash Here 右键出现该选择框表示成功&lt;/td&gt;
        &lt;/tr&gt;
        &lt;tr&gt;
          &lt;td&gt;init&lt;/td&gt;
          &lt;td&gt;初始化&lt;/td&gt;
          &lt;td&gt;git init  初始化&lt;/td&gt;
        &lt;/tr&gt;
        &lt;tr&gt;
          &lt;td&gt;commit&lt;/td&gt;
          &lt;td&gt;提交&lt;/td&gt;
          &lt;td&gt;git commit&lt;/td&gt;
        &lt;/tr&gt;
        &lt;tr&gt;
          &lt;td&gt;unset&lt;/td&gt;
          &lt;td&gt;复位，清除&lt;/td&gt;
          &lt;td&gt;git  config  –global   –unset  user.email &lt;br /&gt;git  config  –global   –unset  user.name&lt;/td&gt;
        &lt;/tr&gt;
        &lt;tr&gt;
          &lt;td&gt;insertion&lt;/td&gt;
          &lt;td&gt;增加&lt;/td&gt;
          &lt;td&gt;Git成功commit的提示：xx files changed, xx insertions(+)&lt;/td&gt;
        &lt;/tr&gt;
        &lt;tr&gt;
          &lt;td&gt;log&lt;/td&gt;
          &lt;td&gt; &lt;/td&gt;
          &lt;td&gt;日志&lt;/td&gt;
        &lt;/tr&gt;
        &lt;tr&gt;
          &lt;td&gt;oneline&lt;/td&gt;
          &lt;td&gt;一行&lt;/td&gt;
          &lt;td&gt;git log –oneline    查看一行类型的日志，包括版本号&lt;/td&gt;
        &lt;/tr&gt;
        &lt;tr&gt;
          &lt;td&gt;reflog&lt;/td&gt;
          &lt;td&gt; &lt;/td&gt;
          &lt;td&gt;git reflog 查看所有日志（包括回滚的日志）&lt;/td&gt;
        &lt;/tr&gt;
        &lt;tr&gt;
          &lt;td&gt;HEAD&lt;/td&gt;
          &lt;td&gt; &lt;/td&gt;
          &lt;td&gt;是一个指向你正在工作中的本地分支的指针&lt;/td&gt;
        &lt;/tr&gt;
        &lt;tr&gt;
          &lt;td&gt;reset&lt;/td&gt;
          &lt;td&gt;重置&lt;/td&gt;
          &lt;td&gt;git    reset    –hard  版本号    版本穿梭&lt;/td&gt;
        &lt;/tr&gt;
        &lt;tr&gt;
          &lt;td&gt;mkdir&lt;/td&gt;
          &lt;td&gt;创建文件夹，创建目录&lt;/td&gt;
          &lt;td&gt;make directory的缩写&lt;/td&gt;
        &lt;/tr&gt;
        &lt;tr&gt;
          &lt;td&gt;cd&lt;/td&gt;
          &lt;td&gt;改变目录&lt;/td&gt;
          &lt;td&gt;change diretory的单词首字母&lt;br /&gt;&lt;/td&gt;
        &lt;/tr&gt;
        &lt;tr&gt;
          &lt;td&gt;echo&lt;/td&gt;
          &lt;td&gt;输出字符&lt;/td&gt;
          &lt;td&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;echo 字符串&lt;/code&gt;输出内容；&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;echo 内容 &amp;gt; 文件名&lt;/code&gt;。创建文件&lt;/td&gt;
        &lt;/tr&gt;
        &lt;tr&gt;
          &lt;td&gt;push&lt;/td&gt;
          &lt;td&gt;推送&lt;/td&gt;
          &lt;td&gt;git push origin master；git push&lt;/td&gt;
        &lt;/tr&gt;
        &lt;tr&gt;
          &lt;td&gt;remote&lt;/td&gt;
          &lt;td&gt; &lt;/td&gt;
          &lt;td&gt;查看远程仓库名字&lt;/td&gt;
        &lt;/tr&gt;
        &lt;tr&gt;
          &lt;td&gt;origin&lt;/td&gt;
          &lt;td&gt;原始&lt;/td&gt;
          &lt;td&gt;远程仓库默认的名字&lt;/td&gt;
        &lt;/tr&gt;
        &lt;tr&gt;
          &lt;td&gt;master&lt;/td&gt;
          &lt;td&gt;主版本&lt;/td&gt;
          &lt;td&gt;一般用来做上线, 做版本发布&lt;/td&gt;
        &lt;/tr&gt;
        &lt;tr&gt;
          &lt;td&gt;dev&lt;/td&gt;
          &lt;td&gt;开发，开发分支&lt;/td&gt;
          &lt;td&gt; &lt;/td&gt;
        &lt;/tr&gt;
        &lt;tr&gt;
          &lt;td&gt;checkout&lt;/td&gt;
          &lt;td&gt; &lt;/td&gt;
          &lt;td&gt;git checkout  分支名。切换分支&lt;/td&gt;
        &lt;/tr&gt;
        &lt;tr&gt;
          &lt;td&gt;branch&lt;/td&gt;
          &lt;td&gt;分支&lt;/td&gt;
          &lt;td&gt;git branch 查看分支    git branch  分支名          新建分支&lt;/td&gt;
        &lt;/tr&gt;
        &lt;tr&gt;
          &lt;td&gt;merge&lt;/td&gt;
          &lt;td&gt;合并，融合&lt;/td&gt;
          &lt;td&gt;git merge 分支名          把分支合并到当前分支&lt;/td&gt;
        &lt;/tr&gt;
        &lt;tr&gt;
          &lt;td&gt;dev&lt;/td&gt;
          &lt;td&gt;开发&lt;/td&gt;
          &lt;td&gt;develop的缩写；dev分支&lt;/td&gt;
        &lt;/tr&gt;
        &lt;tr&gt;
          &lt;td&gt;rm&lt;/td&gt;
          &lt;td&gt;移除&lt;/td&gt;
          &lt;td&gt;remove的简写；git rm –cached  文件名   将文件从暂存区中删除&lt;/td&gt;
        &lt;/tr&gt;
        &lt;tr&gt;
          &lt;td&gt;stash&lt;/td&gt;
          &lt;td&gt;存放&lt;/td&gt;
          &lt;td&gt; &lt;/td&gt;
        &lt;/tr&gt;
        &lt;tr&gt;
          &lt;td&gt;.gitignore&lt;/td&gt;
          &lt;td&gt; &lt;/td&gt;
          &lt;td&gt;把需要忽略的文件和文件夹写在这里&lt;/td&gt;
        &lt;/tr&gt;
        &lt;tr&gt;
          &lt;td&gt;readme&lt;/td&gt;
          &lt;td&gt;说明&lt;/td&gt;
          &lt;td&gt; &lt;/td&gt;
        &lt;/tr&gt;
        &lt;tr&gt;
          &lt;td&gt;respository&lt;/td&gt;
          &lt;td&gt;仓库&lt;/td&gt;
          &lt;td&gt;仓库&lt;/td&gt;
        &lt;/tr&gt;
      &lt;/tbody&gt;
    &lt;/table&gt;
  &lt;/li&gt;
&lt;/ul&gt;</content><author><name></name></author><summary type="html">一:Git</summary></entry><entry><title type="html">Git教程 01</title><link href="https://landon100100.github.io/Git%E6%95%99%E7%A8%8B-01/" rel="alternate" type="text/html" title="Git教程 01" /><published>2024-01-05T00:00:00+00:00</published><updated>2024-01-05T00:00:00+00:00</updated><id>https://landon100100.github.io/Git%E6%95%99%E7%A8%8B-01</id><content type="html" xml:base="https://landon100100.github.io/Git%E6%95%99%E7%A8%8B-01/">&lt;blockquote&gt;
  &lt;p&gt;原文地址 &lt;a href=&quot;https://blog.csdn.net/yangshengwei230612/article/details/121588819&quot;&gt;blog.csdn.net&lt;/a&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;&lt;a href=&quot;https://blog.csdn.net/u013452337/article/details/81017938&quot;&gt;idea git 使用 - 写的很好&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://blog.csdn.net/a749402932/article/details/107148373/&quot;&gt;idea git 配置&lt;/a&gt;&lt;/p&gt;

&lt;h2 id=&quot;配置&quot;&gt;配置&lt;/h2&gt;

&lt;p&gt;&lt;img src=&quot;https://img-blog.csdnimg.cn/ceda5c4ff8df40a59d539f78cd54cb70.png?x-oss-process=image/watermark,type_ZHJvaWRzYW5zZmFsbGJhY2s,shadow_50,text_Q1NETiBA57Sr6J225L6g,size_20,color_FFFFFF,t_70,g_se,x_16&quot; alt=&quot;&quot; /&gt;&lt;br /&gt;
&lt;img src=&quot;https://img-blog.csdnimg.cn/caae7d03817d47b098f75f3d814dc45c.png?x-oss-process=image/watermark,type_ZHJvaWRzYW5zZmFsbGJhY2s,shadow_50,text_Q1NETiBA57Sr6J225L6g,size_20,color_FFFFFF,t_70,g_se,x_16&quot; alt=&quot;&quot; /&gt;&lt;/p&gt;

&lt;h2 id=&quot;创建仓库&quot;&gt;创建仓库&lt;/h2&gt;

&lt;p&gt;&lt;img src=&quot;https://img-blog.csdnimg.cn/8bc787ee165d4919ae3a91558717166f.png?x-oss-process=image/watermark,type_ZHJvaWRzYW5zZmFsbGJhY2s,shadow_50,text_Q1NETiBA57Sr6J225L6g,size_20,color_FFFFFF,t_70,g_se,x_16&quot; alt=&quot;&quot; /&gt;&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;https://img-blog.csdnimg.cn/411d2ee513314be38b972394dba91bb3.png?x-oss-process=image/watermark,type_ZHJvaWRzYW5zZmFsbGJhY2s,shadow_50,text_Q1NETiBA57Sr6J225L6g,size_20,color_FFFFFF,t_70,g_se,x_16&quot; alt=&quot;&quot; /&gt;&lt;/p&gt;

&lt;h3 id=&quot;添加提交&quot;&gt;添加提交&lt;/h3&gt;

&lt;p&gt;往新的仓库中分添加文件并提交&lt;br /&gt;
&lt;img src=&quot;https://img-blog.csdnimg.cn/f4e46a21aec948908e411c33c2fe6b53.png?x-oss-process=image/watermark,type_ZHJvaWRzYW5zZmFsbGJhY2s,shadow_50,text_Q1NETiBA57Sr6J225L6g,size_20,color_FFFFFF,t_70,g_se,x_16&quot; alt=&quot;&quot; /&gt;&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;https://img-blog.csdnimg.cn/7578c6ef0bc6439d990e6a60855c458f.png?x-oss-process=image/watermark,type_ZHJvaWRzYW5zZmFsbGJhY2s,shadow_50,text_Q1NETiBA57Sr6J225L6g,size_20,color_FFFFFF,t_70,g_se,x_16&quot; alt=&quot;&quot; /&gt;&lt;br /&gt;
&lt;img src=&quot;https://img-blog.csdnimg.cn/192cef7cd73540aea3cec52a61b44b6a.png?x-oss-process=image/watermark,type_ZHJvaWRzYW5zZmFsbGJhY2s,shadow_50,text_Q1NETiBA57Sr6J225L6g,size_20,color_FFFFFF,t_70,g_se,x_16&quot; alt=&quot;&quot; /&gt;&lt;br /&gt;
&lt;img src=&quot;https://img-blog.csdnimg.cn/d4134da76b5546399e25908a3d191e2e.png?x-oss-process=image/watermark,type_ZHJvaWRzYW5zZmFsbGJhY2s,shadow_50,text_Q1NETiBA57Sr6J225L6g,size_20,color_FFFFFF,t_70,g_se,x_16&quot; alt=&quot;&quot; /&gt;&lt;/p&gt;

&lt;h3 id=&quot;创建新的分支&quot;&gt;创建新的分支&lt;/h3&gt;

&lt;p&gt;&lt;img src=&quot;https://img-blog.csdnimg.cn/5eedad5acc234c14ae2ddbc277654435.png?x-oss-process=image/watermark,type_ZHJvaWRzYW5zZmFsbGJhY2s,shadow_50,text_Q1NETiBA57Sr6J225L6g,size_20,color_FFFFFF,t_70,g_se,x_16&quot; alt=&quot;&quot; /&gt;&lt;/p&gt;

&lt;h3 id=&quot;查看版本历史&quot;&gt;查看版本历史&lt;/h3&gt;

&lt;p&gt;&lt;img src=&quot;https://img-blog.csdnimg.cn/28d18177a1a2463a81462bf1bea8af90.png?x-oss-process=image/watermark,type_ZHJvaWRzYW5zZmFsbGJhY2s,shadow_50,text_Q1NETiBA57Sr6J225L6g,size_20,color_FFFFFF,t_70,g_se,x_16&quot; alt=&quot;&quot; /&gt;&lt;/p&gt;

&lt;h2 id=&quot;git-仓库目录&quot;&gt;git 仓库目录&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;HEAD&lt;/strong&gt;&lt;br /&gt;
&lt;img src=&quot;https://img-blog.csdnimg.cn/0a8b9037e5f147829b293fc9a9580136.png?x-oss-process=image/watermark,type_d3F5LXplbmhlaQ,shadow_50,text_Q1NETiBA57Sr6J225L6g,size_20,color_FFFFFF,t_70,g_se,x_16&quot; alt=&quot;&quot; /&gt;&lt;br /&gt;
&lt;strong&gt;config&lt;/strong&gt;&lt;br /&gt;
&lt;img src=&quot;https://img-blog.csdnimg.cn/c2b37c5446d349eb9bb41cf71412eb97.png?x-oss-process=image/watermark,type_d3F5LXplbmhlaQ,shadow_50,text_Q1NETiBA57Sr6J225L6g,size_20,color_FFFFFF,t_70,g_se,x_16&quot; alt=&quot;&quot; /&gt;&lt;strong&gt;refs&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;https://img-blog.csdnimg.cn/7ef5810d5bfa4329a7ae308e523ee110.png?x-oss-process=image/watermark,type_d3F5LXplbmhlaQ,shadow_50,text_Q1NETiBA57Sr6J225L6g,size_20,color_FFFFFF,t_70,g_se,x_16&quot; alt=&quot;&quot; /&gt;&lt;/p&gt;

&lt;h2 id=&quot;git-的常用场景&quot;&gt;git 的常用场景&lt;/h2&gt;

&lt;p&gt;我们也可以使用 git checkout -b (branchname) 命令来创建新分支并立即切换到该分支下，从而在该分支中操作。&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;git checkout -b 新建分支名    #默认以当前分支为基础分支创建
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h3 id=&quot;分支切换&quot;&gt;分支切换&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;idea&lt;/strong&gt;&lt;br /&gt;
&lt;img src=&quot;https://img-blog.csdnimg.cn/aaef4adaeff246eaa03ab5abf1bf6209.png?x-oss-process=image/watermark,type_d3F5LXplbmhlaQ,shadow_50,text_Q1NETiBA57Sr6J225L6g,size_20,color_FFFFFF,t_70,g_se,x_16&quot; alt=&quot;&quot; /&gt;&lt;/p&gt;

&lt;h3 id=&quot;合并分支&quot;&gt;合并分支&lt;/h3&gt;

&lt;p&gt;一旦某分支有了独立内容，你终究会希望将它合并回到你的主分支。 你可以使用以下命令将任何分支合并到当前分支中去：&lt;br /&gt;
切换这次合并的主分区，把 test1201 分支合并到 master 分支，就切换到 master 分支&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;git merge test1201  #将test1201合并到当前分支(master)
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h3 id=&quot;删除分支&quot;&gt;删除分支&lt;/h3&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;git branch -D 分支名
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;&lt;img src=&quot;https://img-blog.csdnimg.cn/9c776422c076491f97ccfffa6c8c75c0.png?x-oss-process=image/watermark,type_d3F5LXplbmhlaQ,shadow_50,text_Q1NETiBA57Sr6J225L6g,size_20,color_FFFFFF,t_70,g_se,x_16&quot; alt=&quot;&quot; /&gt;&lt;/p&gt;

&lt;h3 id=&quot;修改最近-commit-的-message&quot;&gt;修改最近 commit 的 message&lt;/h3&gt;

&lt;p&gt;前提是在所涉及修改的 commit 的没有 push 的远程仓库，否则会影响团队其他人员&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;git commit --amend
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;&lt;img src=&quot;https://img-blog.csdnimg.cn/b60984e4f32540d8a1d455b6c1f2eac1.png?x-oss-process=image/watermark,type_d3F5LXplbmhlaQ,shadow_50,text_Q1NETiBA57Sr6J225L6g,size_20,color_FFFFFF,t_70,g_se,x_16&quot; alt=&quot;&quot; /&gt;&lt;/p&gt;

&lt;h3 id=&quot;修改之前几次-commit-的-message&quot;&gt;修改之前几次 commit 的 message&lt;/h3&gt;

&lt;p&gt;前提是在所涉及修改的 commit 的没有 push 的远程仓库，否则会影响团队其他人员&lt;br /&gt;
&lt;img src=&quot;https://img-blog.csdnimg.cn/63ff2a1b98e448bebb60b04e78c0cfb0.png?x-oss-process=image/watermark,type_d3F5LXplbmhlaQ,shadow_50,text_Q1NETiBA57Sr6J225L6g,size_20,color_FFFFFF,t_70,g_se,x_16&quot; alt=&quot;&quot; /&gt;&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;https://img-blog.csdnimg.cn/b7f35a8fe4b24fe78597f813aa565c5e.png?x-oss-process=image/watermark,type_d3F5LXplbmhlaQ,shadow_50,text_Q1NETiBA57Sr6J225L6g,size_20,color_FFFFFF,t_70,g_se,x_16&quot; alt=&quot;&quot; /&gt;&lt;br /&gt;
保存上一个会自动跳出来下一个文件，在下面这文件中修改 message 即可&lt;br /&gt;
&lt;img src=&quot;https://img-blog.csdnimg.cn/0972b707f6c641bc85766c5d29296ddb.png?x-oss-process=image/watermark,type_d3F5LXplbmhlaQ,shadow_50,text_Q1NETiBA57Sr6J225L6g,size_20,color_FFFFFF,t_70,g_se,x_16&quot; alt=&quot;&quot; /&gt;&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;https://img-blog.csdnimg.cn/8ae726b59beb48fa8d50f7f32e7e2994.png?x-oss-process=image/watermark,type_d3F5LXplbmhlaQ,shadow_50,text_Q1NETiBA57Sr6J225L6g,size_20,color_FFFFFF,t_70,g_se,x_16&quot; alt=&quot;&quot; /&gt;&lt;/p&gt;

&lt;h3 id=&quot;多个连续的-commit-合成一个-commit&quot;&gt;多个连续的 commit 合成一个 commit&lt;/h3&gt;

&lt;p&gt;前提是在所涉及修改的 commit 的没有 push 的远程仓库，否则会影响团队其他人员&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;https://img-blog.csdnimg.cn/0c96a2ed73204bcfae6d26fe609c89ec.png?x-oss-process=image/watermark,type_d3F5LXplbmhlaQ,shadow_50,text_Q1NETiBA57Sr6J225L6g,size_20,color_FFFFFF,t_70,g_se,x_16&quot; alt=&quot;&quot; /&gt;&lt;br /&gt;
&lt;img src=&quot;https://img-blog.csdnimg.cn/988914cf1519439681182c723debe43e.png?x-oss-process=image/watermark,type_d3F5LXplbmhlaQ,shadow_50,text_Q1NETiBA57Sr6J225L6g,size_20,color_FFFFFF,t_70,g_se,x_16&quot; alt=&quot;&quot; /&gt;&lt;br /&gt;
&lt;img src=&quot;https://img-blog.csdnimg.cn/a10fc18a601d4296b25d6e9c09ade823.png?x-oss-process=image/watermark,type_d3F5LXplbmhlaQ,shadow_50,text_Q1NETiBA57Sr6J225L6g,size_20,color_FFFFFF,t_70,g_se,x_16&quot; alt=&quot;&quot; /&gt;&lt;br /&gt;
&lt;img src=&quot;https://img-blog.csdnimg.cn/32364d3aaa34494c8c83097fb3af72ee.png?x-oss-process=image/watermark,type_d3F5LXplbmhlaQ,shadow_50,text_Q1NETiBA57Sr6J225L6g,size_20,color_FFFFFF,t_70,g_se,x_16&quot; alt=&quot;&quot; /&gt;&lt;/p&gt;</content><author><name></name></author><summary type="html">原文地址 blog.csdn.net</summary></entry><entry><title type="html">You’re up and running!</title><link href="https://landon100100.github.io/Hello-World/" rel="alternate" type="text/html" title="You’re up and running!" /><published>2014-03-03T00:00:00+00:00</published><updated>2014-03-03T00:00:00+00:00</updated><id>https://landon100100.github.io/Hello-World</id><content type="html" xml:base="https://landon100100.github.io/Hello-World/">&lt;p&gt;Next you can update your site name, avatar and other options using the _config.yml file in the root of your repository (shown below).&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/images/config.png&quot; alt=&quot;_config.yml&quot; /&gt;&lt;/p&gt;

&lt;p&gt;The easiest way to make your first post is to edit this one. Go into /_posts/ and update the Hello World markdown file. For more instructions head over to the &lt;a href=&quot;https://github.com/barryclark/jekyll-now&quot;&gt;Jekyll Now repository&lt;/a&gt; on GitHub.&lt;/p&gt;</content><author><name></name></author><summary type="html">Next you can update your site name, avatar and other options using the _config.yml file in the root of your repository (shown below).</summary></entry></feed>