<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
  <channel>
    <title>孙仲锴</title>
    <description>欢迎来到我的个人站，一起成长</description>
    <link>http://sunzhongkai0110.github.io/</link>
    <atom:link href="http://sunzhongkai0110.github.io/feed.xml" rel="self" type="application/rss+xml"/>
    <pubDate>Fri, 16 Jul 2021 16:04:43 +0000</pubDate>
    <lastBuildDate>Fri, 16 Jul 2021 16:04:43 +0000</lastBuildDate>
    <generator>Jekyll v3.9.0</generator>
    
      <item>
        <title>IDEA部分快捷操作</title>
        <description>&lt;h3 id=&quot;1-跳转操作&quot;&gt;1. 跳转操作&lt;/h3&gt;

&lt;ul&gt;
  &lt;li&gt;编辑区和文件区来回跳转&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Alt + 对应数字，跳转到相应的文件区&lt;/p&gt;

&lt;p&gt;Esc回到编辑区&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;项目之间的跳转&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;上一个窗口：Ctrl + Alt+ [&lt;/p&gt;

&lt;p&gt;下一个窗口：Ctrl + Alt+ ]&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;文件之间的跳转&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Recent file：Ctrl + E&lt;/p&gt;

&lt;p&gt;Recently Edited File：Ctrl + Shift + E&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;修改位置（Last Edit Location）的跳转&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Ctrl + Shift + Backsapce&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;浏览位置的跳转&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Back：Ctrl + Alt + 向左箭头&lt;/p&gt;

&lt;p&gt;Forward：Ctrl + Alt + 向右箭头&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;利用书签进行跳转&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Toggle Bookmark：F11&lt;/p&gt;

&lt;p&gt;Toggle Bookmark with Mnemonic：Ctrl + F11，可以设置书签1、2、3……&lt;/p&gt;

&lt;p&gt;书签之间跳转：Ctrl + 对应数字&lt;/p&gt;

&lt;h3 id=&quot;2-帮助helpfind-action&quot;&gt;2. 帮助（Help–&amp;gt;Find Action）&lt;/h3&gt;

&lt;p&gt;Ctrl + Shift + A&lt;/p&gt;

&lt;h3 id=&quot;3-收藏&quot;&gt;3. 收藏&lt;/h3&gt;

&lt;ul&gt;
  &lt;li&gt;收藏位置&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Alt + 2&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;加入收藏（Add to Favorites）&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Ctrl + Alt + F&lt;/p&gt;

&lt;h3 id=&quot;4-精准搜索&quot;&gt;4. 精准搜索&lt;/h3&gt;

&lt;ul&gt;
  &lt;li&gt;类（Class）&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Ctrl + N&lt;/p&gt;

&lt;p&gt;按两次Ctrl + N：可以搜索到jar包里的类&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;文件（File）&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Ctrl + Shift + N&lt;/p&gt;

&lt;p&gt;按两次Ctrl + Shift + N：可以搜索到jar包里的文件&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;符号（Symbol）【函数、属性】&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Ctrl + Alt + Shift + N&lt;/p&gt;

&lt;p&gt;按两次Ctrl + Shift + N：可以搜索到jar包里的符号&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;字符串（Find in Path）&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Ctrl + Shift + F&lt;/p&gt;

&lt;p&gt;其中，一些选项的含义：&lt;/p&gt;

&lt;p&gt;Match Case：是否匹配大小写&lt;/p&gt;

&lt;p&gt;Words：字符串是否是一个单词&lt;/p&gt;

&lt;p&gt;Regex：通过正则表达式搜索&lt;/p&gt;

&lt;p&gt;File Mask：指定在哪个文件中搜索&lt;/p&gt;

&lt;h3 id=&quot;5-列操作&quot;&gt;5. 列操作&lt;/h3&gt;

&lt;ul&gt;
  &lt;li&gt;移动到单词结尾（Move Caret to Next Word）&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Ctrl + 向右箭头&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;单词大小写切换（Toggle Case）&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Ctrl + Shift + U&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;移动到行首（Move Caret to Line Start）&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Home&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;移动到行尾（Move Caret to Line End）&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;End&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;选中每一行同一个单词进行批量操作（Select All Occurrences）&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Ctrl + Alt + Shift + J&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;注释代码行&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Ctrl + /&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;注释代码块&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Shift + Ctrl + /&lt;/p&gt;

&lt;h3 id=&quot;6-live-template&quot;&gt;6. Live Template&lt;/h3&gt;

&lt;ul&gt;
  &lt;li&gt;
    &lt;p&gt;按住Ctrl + Shift + A，通过Help，输入Live Template（或者在Edit菜单栏下Setting），打开对话框&lt;/p&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;添加Template Group&lt;/p&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;再添加Live Template&lt;/p&gt;
  &lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;img src=&quot;/images/posts/IDEA/IDEA1.png&quot; alt=&quot;&quot; /&gt;&lt;/p&gt;

&lt;h3 id=&quot;7-使用postfix-completion快捷输入&quot;&gt;7. 使用Postfix Completion快捷输入&lt;/h3&gt;

&lt;ul&gt;
  &lt;li&gt;
    &lt;p&gt;for：比如：100.for–&amp;gt;for(int i=0;i&amp;lt;100;i++)&lt;/p&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;sout：快速输出，比如：new Data().sout–&amp;gt;System.out.println(new Data);&lt;/p&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;filed：比如：name.fi自动补齐name定义和this.name=name，生成属性值&lt;/p&gt;

    &lt;p&gt;public class User {&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; private final String name;

 public User(String name){

     this.name = name;

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

    &lt;p&gt;}&lt;/p&gt;
  &lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;img src=&quot;/images/posts/IDEA/IDEA2.png&quot; alt=&quot;&quot; /&gt;&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;
    &lt;p&gt;user.return：返回语句自动生成return user;&lt;/p&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;user.nn：判断语句自动生成&lt;/p&gt;
  &lt;/li&gt;
&lt;/ul&gt;

&lt;h3 id=&quot;8-alt--enter&quot;&gt;8. Alt + Enter&lt;/h3&gt;

&lt;ul&gt;
  &lt;li&gt;
    &lt;p&gt;自动创建函数（Help–&amp;gt;Find Action–&amp;gt;Show Iintention Actions）&lt;/p&gt;

    &lt;p&gt;Alter + Enter&lt;/p&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;list replace&lt;/p&gt;

    &lt;p&gt;List&lt;String&gt; a = new ArrayList();&lt;/String&gt;&lt;/p&gt;

    &lt;p&gt;for(int i=0;i&amp;lt;a.size();i){&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; String item = list.get(i);
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;    &lt;/div&gt;

    &lt;p&gt;}&lt;/p&gt;

    &lt;p&gt;将光标定位于for行首,按Alt+Enter，Replace with “foreach”&lt;/p&gt;

    &lt;p&gt;List&lt;String&gt; a = new ArrayList();&lt;/String&gt;&lt;/p&gt;

    &lt;p&gt;for(String item : list){&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; String item = list.get(i);
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;    &lt;/div&gt;

    &lt;p&gt;}&lt;/p&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;字符串 Format 或 Build&lt;/p&gt;
  &lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;拼接字符串 “name:  “+name+”, age:  “+age&lt;/p&gt;

&lt;p&gt;Format：只需将光标放在”后，name前按下Alter + Enter,选择Replace “+” with String.fromat()&lt;/p&gt;

&lt;p&gt;Build：只需将光标放在”后，name前按下Alter + Enter,选择Replace ‘+” with StringBuilder.append()&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;实现接口&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;定义一个接口，在接口名上按Alter + Enter后，选择Implement Interface,会创建实现类&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;
    &lt;p&gt;单词拼写&lt;/p&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;导包&lt;/p&gt;
  &lt;/li&gt;
&lt;/ul&gt;

&lt;h3 id=&quot;9-重构&quot;&gt;9. 重构&lt;/h3&gt;

&lt;p&gt;方法一：在函数签名上重构Refactor–&amp;gt;Change Signature：Ctrl + F6&lt;/p&gt;

&lt;p&gt;在定义public void sayHello(String firstName){}方法上按下 Ctrl + F6 ,添加一个参数lastName&lt;/p&gt;

&lt;p&gt;方法二：在调用方法的地方this.sayHello(firstName,lastName);&lt;/p&gt;

&lt;p&gt;在调用的地方，直接添加一个参数lastName后，光标置于参数上，按下Alter + Enter,选择Add  ‘String’   as 2nd parameter to method ‘sayHello’&lt;/p&gt;

&lt;h3 id=&quot;10-抽取&quot;&gt;10. 抽取&lt;/h3&gt;

&lt;ul&gt;
  &lt;li&gt;抽取变量： Refactor–&amp;gt;Extract–&amp;gt;Variable：Ctrl + Alt + V&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;在需要修改的地方，按下Ctrl + Alt + V，选择Replace all 6 occurrences&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;
    &lt;p&gt;抽取静态变量：Refactor–&amp;gt;Extract–&amp;gt;Contant：Ctrl + Alt + C&lt;/p&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;抽取成员变量：Refactor–&amp;gt;Extract–&amp;gt;Field：Ctrl + Alt + F&lt;/p&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;抽取方法参数：Refactor–&amp;gt;Extract–&amp;gt;Parameter&lt;/p&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;抽取函数：Refactor–&amp;gt;Extract–&amp;gt;Method ：Ctrl + Alt + M&lt;/p&gt;
  &lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;将一部分代码转换成函数的形式Replace all occurrences&lt;/p&gt;

&lt;h3 id=&quot;11-git的集成&quot;&gt;11. git的集成&lt;/h3&gt;

&lt;ul&gt;
  &lt;li&gt;当不理解某一行代码的意思，需要寻找该行代码的作者时&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;在相应的行前，右击，选择Annotate&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;移动所有改动之处&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;下一个修改地方（Navigate–&amp;gt;Next Change） Ctrl + Alt + Shift + 向下箭头&lt;/p&gt;

&lt;p&gt;上一个修改地方（Navigate–&amp;gt;Previous Change）Ctrl + Alt + Shift + 向上箭头&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;撤销，包括单个和项目改动之处 （Revert）&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;撤销 Ctrl + Alt + Z  回滚代码到你上一次提交的状态&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;本地版本控制（local history）&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Ctrl + Alt + A 输入内容Local History，选择Show History&lt;/p&gt;

&lt;p&gt;建立Label：改动后，按住Ctrl + Alt + A，输入Local History ，选择Put Label，输入名称，再次Show History，就可以看到Label&lt;/p&gt;

&lt;h3 id=&quot;12-spring-关联&quot;&gt;12. Spring 关联&lt;/h3&gt;

&lt;p&gt;File–&amp;gt;Project Structure(Ctrl + Alt + Shift + S)–&amp;gt;Facets–&amp;gt;点击加号–&amp;gt;选择Spring&lt;/p&gt;

&lt;h3 id=&quot;13-断点调试&quot;&gt;13. 断点调试&lt;/h3&gt;

&lt;ul&gt;
  &lt;li&gt;设置断点（run–&amp;gt;toggle line breakpoint）&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Ctrl + F8&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;单步运行（run–&amp;gt;ebug“main”）&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Shift + F9&lt;/p&gt;

&lt;p&gt;一行行运行：F8&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;直接调至下一个断点（Resume Program）&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;F9&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;查看所有断点&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Shift + Ctrl + F8&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;
    &lt;p&gt;禁止所有断点（Mute Breakpoints）&lt;/p&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;条件断点&lt;/p&gt;
  &lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Shift + Ctrl + F8&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;表达式求值（Run–&amp;gt;Evaluate Expression）&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Alt + F8&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;运行到指定行（Run to Cursor）&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Alt + F9&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;Set Value 动态改变运行时对象的值&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;在变量窗口中指定变量上按下F2，可以修改对象的值&lt;/p&gt;

&lt;h3 id=&quot;14-run-anywhere-if-you-can&quot;&gt;14. run anywhere if you can&lt;/h3&gt;

&lt;ul&gt;
  &lt;li&gt;运行当前上下文&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Ctrl + Alt + A 输入内容 Debug Context Configuration Ctrl + Shift + X&lt;/p&gt;

&lt;p&gt;Windows系统中没有Debug Context Configuration快捷键，设置Debug Context Configuration的方法如下：&lt;/p&gt;

&lt;p&gt;（1）点击File菜单，选中Settings&lt;/p&gt;

&lt;p&gt;（2）在弹出的对话框的左侧中，选择Keymap，在右侧选择Others&lt;/p&gt;

&lt;p&gt;（3）找到Debug Context Configuration，右击选择Add Keyboard Shortcut，设置快捷键&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;在当前可运行列表中选择一个运行&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Shift + Alt + F9&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;
    &lt;p&gt;编辑当前运行Edit Configurations&lt;/p&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;文件操作&lt;/p&gt;
  &lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;F5: 拷贝当前文件&lt;/p&gt;

&lt;p&gt;F6: 移动当前文件&lt;/p&gt;

&lt;p&gt;复制文件全路径：Ctrl + Shift + C&lt;/p&gt;

&lt;p&gt;打开剪切板：Ctrl + Shift + V&lt;/p&gt;

&lt;h3 id=&quot;15-结构图&quot;&gt;15. 结构图&lt;/h3&gt;

&lt;ul&gt;
  &lt;li&gt;查看当前文件的大纲Field，Method（Navigat–&amp;gt;File Structure）&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Ctrl + F12&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;查看Maven 依赖，类图（pom.xml里右击–&amp;gt;Maven–&amp;gt;Show Dependencies）&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Ctrl + Shift + Alt + U&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;查看类的继承结构，方法的调用层次（Hierarchy Class Son）&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Ctrl + H&lt;/p&gt;

&lt;h3 id=&quot;16-方法调用层次&quot;&gt;16. 方法调用层次&lt;/h3&gt;

&lt;p&gt;Call Hierarchy：显示方法的调用层次：Ctrl + Alt + H&lt;/p&gt;

&lt;h3 id=&quot;更详细的资料请参见&quot;&gt;更详细的资料请参见&lt;/h3&gt;

&lt;p&gt;IntelliJ IDEA神器使用技巧&lt;/p&gt;

&lt;p&gt;https://www.imooc.com/learn/924&lt;/p&gt;

&lt;p&gt;IntelliJ IDEA官方文档&lt;/p&gt;

&lt;p&gt;https://www.w3cschool.cn/intellij_idea_doc/&lt;/p&gt;

&lt;p&gt;转载请注明：&lt;a href=&quot;https://sunzhongkai0110.github.io&quot;&gt;孙仲锴的博客&lt;/a&gt; » &lt;a href=&quot;https://sunzhongkai0110.github.io/2019/03/IDEA部分快捷操作/&quot;&gt;IDEA部分快捷操作&lt;/a&gt;&lt;/p&gt;
</description>
        <pubDate>Sun, 17 Mar 2019 00:00:00 +0000</pubDate>
        <link>http://sunzhongkai0110.github.io/2019/03/IDEA%E9%83%A8%E5%88%86%E5%BF%AB%E6%8D%B7%E6%93%8D%E4%BD%9C/</link>
        <guid isPermaLink="true">http://sunzhongkai0110.github.io/2019/03/IDEA%E9%83%A8%E5%88%86%E5%BF%AB%E6%8D%B7%E6%93%8D%E4%BD%9C/</guid>
        
        <category>IDEA</category>
        
        
      </item>
    
      <item>
        <title>Git命令使用（GitHub篇）</title>
        <description>&lt;h3 id=&quot;1-将项目从github克隆到本地git-clone&quot;&gt;1. 将项目从GitHub克隆到本地：git clone&lt;/h3&gt;

&lt;p&gt;&lt;img src=&quot;/images/posts/Git/Git1.png&quot; alt=&quot;&quot; /&gt;&lt;/p&gt;

&lt;p&gt;问题1：当该路径下已经存在与repository同名的文件夹，则会出现如下错误：&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/images/posts/Git/Git2.png&quot; alt=&quot;&quot; /&gt;&lt;/p&gt;

&lt;p&gt;解决方法：到该路径下删除或重命名同名文件夹&lt;/p&gt;

&lt;p&gt;问题2：执行目录错误，执行目录一定要切换到根目录~&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/images/posts/Git/Git3.png&quot; alt=&quot;&quot; /&gt;&lt;/p&gt;

&lt;p&gt;解决方法：切换到根目录  cd~&lt;/p&gt;

&lt;p&gt;区别：git clone和git pull&lt;/p&gt;

&lt;p&gt;git clone:适用于本地没有repository的情况，将整个repository从GitHub下载下来&lt;/p&gt;

&lt;p&gt;git pull:适用于本地有repository的情况，将repository 里更新后数据下载过来，并且与本地代码merge&lt;/p&gt;

&lt;h3 id=&quot;2-进入要push的目标文件夹右击打开git-bash&quot;&gt;2. 进入要push的目标文件夹，右击，打开Git Bash&lt;/h3&gt;

&lt;p&gt;&lt;img src=&quot;/images/posts/Git/Git4.png&quot; alt=&quot;&quot; /&gt;&lt;/p&gt;

&lt;h3 id=&quot;3-初始化git-init&quot;&gt;3. 初始化：git init&lt;/h3&gt;

&lt;p&gt;init后会出现.git隐藏文件夹—本地代码库&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/images/posts/Git/Git5.png&quot; alt=&quot;&quot; /&gt;&lt;/p&gt;

&lt;h3 id=&quot;4-加载文件git-add-注意先空格再键入点&quot;&gt;4. 加载文件：git add .(注意：先空格再键入点.)&lt;/h3&gt;

&lt;p&gt;&lt;img src=&quot;/images/posts/Git/Git6.png&quot; alt=&quot;&quot; /&gt;&lt;/p&gt;

&lt;h3 id=&quot;5-提交文件创建时间点git-commit--m-时间点&quot;&gt;5. 提交文件，创建时间点：git commit -m “时间点”&lt;/h3&gt;

&lt;p&gt;&lt;img src=&quot;/images/posts/Git/Git7.png&quot; alt=&quot;&quot; /&gt;&lt;/p&gt;

&lt;h3 id=&quot;6-查看状态git-status&quot;&gt;6. 查看状态：git status&lt;/h3&gt;

&lt;p&gt;&lt;img src=&quot;/images/posts/Git/Git8.png&quot; alt=&quot;&quot; /&gt;&lt;/p&gt;

&lt;h3 id=&quot;7-推送代码&quot;&gt;7. 推送代码&lt;/h3&gt;

&lt;p&gt;第一次推送，添加远程的代码库到配置：git remote add origin https://github.com/your repositoryname&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/images/posts/Git/Git9.png&quot; alt=&quot;&quot; /&gt;&lt;/p&gt;

&lt;p&gt;问题：如果之前添加过配置，则会出现问题&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/images/posts/Git/Git10.png&quot; alt=&quot;&quot; /&gt;&lt;/p&gt;

&lt;p&gt;解决方法：无需添加配置，推送代码即可&lt;/p&gt;

&lt;p&gt;推送代码：git push origin master&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/images/posts/Git/Git11.png&quot; alt=&quot;&quot; /&gt;&lt;/p&gt;

&lt;p&gt;问题：如果GitHub上repository比本地代码库的代码新，则会出现问题&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/images/posts/Git/Git12.png&quot; alt=&quot;&quot; /&gt;&lt;/p&gt;

&lt;p&gt;解决方法：将GitHub上的代码pull下来，在本地修改，再将修改后的代码push到GitHub上&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/images/posts/Git/Git13.png&quot; alt=&quot;&quot; /&gt;&lt;/p&gt;

&lt;p&gt;强制推送：git push -f origin master&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/images/posts/Git/Git14.png&quot; alt=&quot;&quot; /&gt;&lt;/p&gt;

&lt;h3 id=&quot;参考资料&quot;&gt;参考资料：&lt;/h3&gt;

&lt;p&gt;Git 中 pull 和 clone 的区别
https://blog.csdn.net/HeatDeath/article/details/79135462&lt;/p&gt;

&lt;p&gt;Git之Github使用（一）：Push代码到Github
http://www.cnblogs.com/android-blogs/p/5816833.html&lt;/p&gt;

&lt;p&gt;转载请注明：&lt;a href=&quot;https://sunzhongkai0110.github.io&quot;&gt;孙仲锴的博客&lt;/a&gt; » &lt;a href=&quot;https://sunzhongkai0110.github.io/2019/03/2019/03/Git命令使用-GitHub篇/&quot;&gt;Git命令使用(GitHub篇)&lt;/a&gt;&lt;/p&gt;

</description>
        <pubDate>Sat, 09 Mar 2019 00:00:00 +0000</pubDate>
        <link>http://sunzhongkai0110.github.io/2019/03/Git%E5%91%BD%E4%BB%A4%E4%BD%BF%E7%94%A8-GitHub%E7%AF%87/</link>
        <guid isPermaLink="true">http://sunzhongkai0110.github.io/2019/03/Git%E5%91%BD%E4%BB%A4%E4%BD%BF%E7%94%A8-GitHub%E7%AF%87/</guid>
        
        <category>Git</category>
        
        
      </item>
    
  </channel>
</rss>
