Git 使用学习笔记
  • 本书介绍
  • Git基础
    • Git追踪文件的生命周期
    • 文件状态
    • 修改类型
    • 理解Git三个树
    • 理解git checkout与git reset区别
  • Git基本命令
    • 文件操作
      • git mv
      • git rm
      • git add
    • 查询
      • git status
      • git diff & git difftool
      • git log
    • 提交、撤销与拉取
      • git commit
      • git checkout
      • git reset
    • 远程库操作
      • git clone
      • git remote
      • git fetch
      • git push
    • 标签
      • git tag & git show
    • 分支操作与管理
      • git branch
      • git checkout
      • git merge
      • git rebase
    • 偏好设置
      • git config
  • Git高级命令
    • 储藏与清理
      • git stash
    • 提取
      • git cherry-pick
    • 常用场景实战
      • 修改commit提交
      • 修改远程仓库提交
  • .gitignore
    • 使用.gitignore文件
    • glob模式
  • GitLab操作
    • 什么是GitLab
    • 基于 Merge Request 的开发流程
    • 如何撤销 Merge Request?
Powered by GitBook
On this page

Was this helpful?

  1. Git基础

文件状态

  • Untracked: 未跟踪文件

    定义:没有被git跟踪的文件,通常是新添加的文件,上一个commit不存在的文件

    git status 显示内容

    缩写:?? (红色)

    Untracked files:
    (use "git add <file>..." to include in what will be committed)
    
        new.js

    git status -s 显示内容

    ??  new.js
  • Unstage: 修改未在暂存区

    定义:所有的更改未提交到暂存区的文件集合(未使用 git add 命令)

    缩写:M D (红色,右面)

    Changes not staged for commit:
      (use "git add <file>..." to update what will be committed)
      (use "git checkout -- <file>..." to discard changes in working directory)
    
            modified:   new.js
            modified:   README.md

    git status -s 显示内容

     M new.js
     D edit.js
  • Stage: 修改已在暂存区状态

    定义:所有的更改已提交暂存区且准备提交到库的文件集合:更改包括以下动作

    缩写:M A D R (绿色,左面)

    Untracked files:
    (use "git add <file>..." to include in what will be committed)
    
        new.js

    git status -s 显示内容

    M  new.js
    D  edit.js
PreviousGit追踪文件的生命周期Next修改类型

Last updated 6 years ago

Was this helpful?