<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:content="http://purl.org/rss/1.0/modules/content/"><channel><title>Git on My Blog</title><link>/tags/git/</link><description>Recent content in Git on My Blog</description><generator>Hugo</generator><language>en-us</language><lastBuildDate>Fri, 26 Aug 2016 00:00:00 +0000</lastBuildDate><atom:link href="/tags/git/index.xml" rel="self" type="application/rss+xml"/><item><title>git常见问题</title><link>/2016/08/26/git%E5%B8%B8%E8%A7%81%E9%97%AE%E9%A2%98/</link><pubDate>Fri, 26 Aug 2016 00:00:00 +0000</pubDate><guid>/2016/08/26/git%E5%B8%B8%E8%A7%81%E9%97%AE%E9%A2%98/</guid><description>&lt;!-- toc --&gt;
&lt;p&gt;[TOC]&lt;/p&gt;
&lt;h2 id="1git删除文件"&gt;1.git删除文件&lt;/h2&gt;
&lt;p&gt;当我们想要删除某个文件,直接删除是没有用的.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;[root@vultr hexo]# git status
# On branch master
nothing to commit (working directory clean)
[root@vultr hexo]# rm source/_posts/test.txt
rm: remove regular empty file `source/_posts/test.txt&amp;#39;? y
[root@vultr hexo]# git status
# On branch master
# Changed but not updated:
# (use &amp;#34;git add/rm &amp;lt;file&amp;gt;...&amp;#34; to update what will be committed)
# (use &amp;#34;git checkout -- &amp;lt;file&amp;gt;...&amp;#34; to discard changes in working directory)
#
# deleted: source/_posts/test.txt
#
no changes added to commit (use &amp;#34;git add&amp;#34; and/or &amp;#34;git commit -a&amp;#34;)
[root@vultr hexo]# git add .
[root@vultr hexo]# git commit -m &amp;#34;delete test file &amp;#34;
# On branch master
# Changed but not updated:
# (use &amp;#34;git add/rm &amp;lt;file&amp;gt;...&amp;#34; to update what will be committed)
# (use &amp;#34;git checkout -- &amp;lt;file&amp;gt;...&amp;#34; to discard changes in working directory)
#
# deleted: source/_posts/test.txt
#
no changes added to commit (use &amp;#34;git add&amp;#34; and/or &amp;#34;git commit -a&amp;#34;)
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;直接使用&lt;code&gt;rm&lt;/code&gt; 删除的仅仅是工作区的文件,并没有删除暂存区,所以&lt;code&gt;commit&lt;/code&gt; 不会生效. 由于平时使用基本都是修改或者增加新文件,大家习惯用 &lt;code&gt;git add &lt;/code&gt; 命令,而忽略了 &lt;code&gt;git rm&lt;/code&gt; , 其实在&lt;code&gt;git status&lt;/code&gt; 都有提示,仔细看看就知道了.&lt;/p&gt;</description></item><item><title>Git 使用指南</title><link>/2016/02/13/git-%E4%BD%BF%E7%94%A8%E6%8C%87%E5%8D%97/</link><pubDate>Sat, 13 Feb 2016 00:00:00 +0000</pubDate><guid>/2016/02/13/git-%E4%BD%BF%E7%94%A8%E6%8C%87%E5%8D%97/</guid><description>&lt;!-- toc --&gt;
&lt;p&gt;[TOC]&lt;/p&gt;
&lt;h1 id="git-使用指南"&gt;Git 使用指南&lt;/h1&gt;
&lt;p&gt;&lt;code&gt; git命令&lt;/code&gt; &lt;code&gt; 版本控制&lt;/code&gt;&lt;/p&gt;
&lt;h2 id="git-简介"&gt;Git 简介&lt;/h2&gt;
&lt;blockquote&gt;
&lt;p&gt;Git是目前世界上最先进的分布式版本控制系统。&lt;/p&gt;
&lt;p&gt;如果你是小白，可以先看&lt;a href="http://www.liaoxuefeng.com/wiki/0013739516305929606dd18361248578c67b8067c8c017b000"&gt;廖雪峰的官方教程&lt;/a&gt;&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;&lt;img alt="git操作流程图" loading="lazy" src="/2016/02/13/git-%E4%BD%BF%E7%94%A8%E6%8C%87%E5%8D%97/git%E6%93%8D%E4%BD%9C%E6%B5%81%E7%A8%8B%E5%9B%BE.PNG"&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;专用名词&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Workspace: 工作区&lt;/li&gt;
&lt;li&gt;Index / Stage: 暂存区&lt;/li&gt;
&lt;li&gt;Repository: 仓库区 ( 本地版本库 )&lt;/li&gt;
&lt;li&gt;Remote: 远程仓库 ( 远程仓库 / 远程版本库 )&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id="代码库"&gt;代码库&lt;/h2&gt;
&lt;p&gt;在当前目录新建一个Git代码库&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;git init
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;新建一个目录，将其初始化为Git代码库&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;git init [project-name]
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;克隆代码库&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;git clone [url]
&lt;/code&gt;&lt;/pre&gt;&lt;h2 id="git-配置"&gt;Git 配置&lt;/h2&gt;
&lt;p&gt;Git的配置文件为 &lt;code&gt;.git/config&lt;/code&gt; ，它可以在用户主目录下（全局配置），也可以在项目目录下（项目配置）。&lt;/p&gt;
&lt;p&gt;显示当前Git配置&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;git config --list
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;编辑Git配置文件&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;git config -e [--global]
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;设置代码时的用户信息 &lt;strong&gt;建议设置此项，后面的操作会很方便&lt;/strong&gt;&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;git config [--global] user.name &amp;#34;[name]&amp;#34;
&lt;/code&gt;&lt;/pre&gt;&lt;pre tabindex="0"&gt;&lt;code&gt;git config [--global] user.email &amp;#34;[email address]&amp;#34;
&lt;/code&gt;&lt;/pre&gt;&lt;h2 id="增加删除文件"&gt;增加/删除文件&lt;/h2&gt;
&lt;p&gt;&lt;strong&gt;操作之前先执行 &lt;code&gt;git status &lt;/code&gt; 查看一下状态&lt;/strong&gt;&lt;/p&gt;</description></item></channel></rss>