zoukankan      html  css  js  c++  java
  • Git的基本原理与常用命令[二]

    标签(linux): git

    笔者Q:972581034 交流群:605799367。有任何疑问可与笔者或加群交流

    git 的四个区域

    四种状态

    常用命令

    git add                #加入暂存(索引区)
    git status            #查看状态
    git status -s        #状态概览
    git diff                  #尚未暂存的文件
    git diff --staged  #暂存区文件
    git commit          #提交更新
    git reset              #回滚
    git rm                  #从版本库中移除
    git rm --cached README        #从暂存区中移除
    git mv                 #相当于mv git rm git add
    

    查看历史版本

    [root@git test]# git log
    commit 1cf6888d97b0a361a3daed01a06c67936bc4f241
    Author: chentiangang <chentiangang@yoho8.com>
    Date:   Thu Aug 17 23:49:27 2017 +0800
    
        first index:v2
    
    commit 145b100cd0e07a9e59e15cf71aad3338ed8a57a6
    Author: chentiangang <chentiangang@yoho8.com>
    Date:   Thu Aug 17 23:42:32 2017 +0800
    
        index.html
    

    创建一个新的文件

    [root@git test]# echo "news" > news.html
    [root@git test]# ls
    index.html  news.html  pay.html
    [root@git test]# git status
    On branch master
    Changes to be committed:
      (use "git reset HEAD <file>..." to unstage)
    
    	new file:   pay.html
    
    Untracked files:
      (use "git add <file>..." to include in what will be committed)
    
    	news.html
    

    删除刚才提交到暂存区的文件

    [root@git test]# git rm --cached pay.html
    rm 'pay.html'
    [root@git test]# git status 
    On branch master
    Untracked files:
      (use "git add <file>..." to include in what will be committed)
    
    	news.html
    	pay.html
    
    nothing added to commit but untracked files present (use "git add" to track)
    
  • 相关阅读:
    常用的STL
    CString,string,char数组的转换
    linux知识
    十一种通用滤波算法(转)
    修复被勒索病毒cl0p损坏的svn代码
    android shell 转发代理shell示例
    3proxy配置
    windbg调试写dmp,随机名字
    nexus6p刷机注意
    mysql语句学习
  • 原文地址:https://www.cnblogs.com/Csir/p/7373879.html
Copyright © 2011-2022 走看看