搜索泥称 发表于 2018-9-16 11:16:21

Git基本操作用法

$ git add . #添加所有改动过的文件  
    // 如果想忽略某个文件,需要新建一个.gitignore文件,写入想忽略的文件名称
  

  
$ git add#添加指定的文件
  
$ git mv   #文件重命名
  
$ git rm#删除文件
  
$ git rm -cached#停止跟踪文件但不删除
  
$ git commit -m# 提交指定文件
  
$ git commit -m “commit message” #提交所有更新过的文件
  
$ git commit -amend # 修改最后一次提交
  
$ git commit -C HEAD -a -amend #增补提交(不会产生新的提交历史纪录)
  

  
// 一次完整的操作 例   1、git add filename
  
            2、git commit -m filename
  

  
删除例   1、$ vim abc.txt    //先创建一个文件//创建完之后如果不提交,git rm filename是无法操作的
  
      2、$ git add abc.txt //提交
  
      3、$ git commit abc.txt//上传
  
          hint: Waiting for your editor to close the file...会打开一个文件,图2.3
  
      4、$ git rm abc.txt -f   //强制删除


页: [1]
查看完整版本: Git基本操作用法