• git add :stage the file

  • git rm --cached : unstage the file

    SRE实战 互联网时代守护先锋,助力企业售后服务体系运筹帷幄!一键直达领取阿里云限量特价优惠。
  • git status :查看当前状态

  • vim readtest: new file
    git status 会发现 untracked files : #r readtest

git add readtest : add readtest into the staged area and track it.

readtest会出现在 changes to be committed下 说明已readtest已进入暂存状态 staged

  • vim README.md 做出修改后, :wq 保存退出

  • git status : changes not staged for commit
    • git add README.md : to update what has been changed
    • git checkout -- : to discard the changes in working directory
  1. $ git mv README.txt README
    $ git status
    On branch master
    Changes to be committed:
    (use "git reset HEAD ..." to unstage)

      renamed:    README.txt -> README

其实 git mv运行了三条命令
$ mv README.txt README
$ git rm README.txt
$ git add README

扫码关注我们
微信号:SRE实战
拒绝背锅 运筹帷幄