在撤销修改一节中,我们知道,命令git reset HEAD file可以把暂存区的修改撤销掉(unstage),重新放回工作区。 既然是一个unstage操作,就可以配置一个unstage别名: $ git config --global alias.unstage 'reset HEAD' 当你敲入命令: $ git unstage
Changes to be committed: (use "git restore --staged <file>..." to unstage) new file: case 有2个参数可选 unstaged, branch, 默认是–mode=unstaged git 文件的2个状态 untrack 没加到git里面的新文件 unstaged staged:暂存状态, unstage add 过的文件 先弄清楚什么是 untrack 状态,当我们 pycharm 打开 git 项目,新增一个文件的时候,会弹出询问框:是否加到 git 文件 如果选择是,文件会变绿色,也就是 unstage 是 Untracked files > git status Changes to be committed: (use "git restore --staged <file>..." to unstage
status On branch master Initial commit Changes to be committed: (use "git rm --cached <file>..." to unstage status On branch master Initial commit Changes to be committed: (use "git rm --cached <file>..." to unstage status On branch master Initial commit Changes to be committed: (use "git rm --cached <file>..." to unstage
Changes to be committed: (use "git restore --staged <file>..." to unstage) new file: case 有2个参数可选 unstaged, branch, 默认是–mode=unstaged git 文件的2个状态 untrack 没加到git里面的新文件 unstaged staged:暂存状态, unstage add 过的文件 先弄清楚什么是 untrack 状态,当我们 pycharm 打开 git 项目,新增一个文件的时候,会弹出询问框:是否加到 git 文件 如果选择是,文件会变绿色,也就是 unstage 是 Untracked files > git status Changes to be committed: (use "git restore --staged <file>..." to unstage
status 这意味着,当要输入 git commit 时,只需要输入 git ci 为了解决取消暂存文件的易用性问题,可以向 Git 中添取消暂存别名 $ git config --global alias.unstage 'reset HEAD --' 这会使下面的两个命令等价: $ git unstage fileA $ git reset HEAD -- fileA 通常也会添加一个 last 命令 $ git config
Changes to be committed: (use "git restore --staged <file>..." to unstage) new file: README Changes to be committed: (use "git reset HEAD <file>..." to unstage) new file: README Changes Changes to be committed: (use "git reset HEAD <file>..." to unstage) new file: README modified Changes to be committed: (use "git reset HEAD <file>..." to unstage) modified: README Changes Changes to be committed: (use "git reset HEAD <file>..." to unstage) modified: CONTRIBUTING.md
commits yet Changes to be committed: (use “git rm –cached <file>…" to unstage status On branch master Changes to be committed: (use “git reset HEAD <file>…" to unstage status On branch master Changes to be committed: (use “git reset HEAD <file>…" to unstage status On branch master Changes to be committed: (use “git reset HEAD <file>…" to unstage
例如,为了解决取消暂存文件的易用性问题,可以向 Git 中添加你自己的取消暂存别名: $ git config --global alias.unstage 'reset HEAD --' 这会使下面的两个命令等价 : $ git unstage fileA $ git reset HEAD -- fileA 这样看起来更清楚一些。
$ git reset filename #Unstage one files $ git reset HEAD #Unstage all files unstage 文件的变化可以被丢弃 $ git checkout 版本号 -- filename #Unstage one file, and only it go back to the revision. (可以不需要版本号) $ git reset HEAD --hard #Unstage all + discard all changes, cannot be undone!!! $ git reset --hard HEAD^^ #Back to last two submission $ git stash #Unstage
git add * $ git status On branch master Changes to be committed: (use "git reset HEAD <file>..." to unstage CONTRIBUTING.md $ git status On branch master Changes to be committed: (use "git reset HEAD <file>..." to unstage CONTRIBUTING.md $ git status On branch master Changes to be committed: (use "git reset HEAD <file>..." to unstage
Changes to be committed: (use "git reset HEAD <file>..." to unstage) new file: pytest_demo 个参数可选 unstaged, branch, 默认是--mode=unstaged git 文件的2个状态 untrack 没加到git里面的新文件 unstaged staged: 暂存状态, unstage 如果选择是,文件会变绿色,也就是 unstage 状态(没git add 过);选择否,那就是一个新文件,未被加到当前分支的 git 目录里面,文件颜色是棕色。 Changes to be committed: (use "git reset HEAD <file>..." to unstage) new file: pytest_demo
. $ git status On branch master Changes to be committed: (use "git reset HEAD <file>..." to unstage benchmarks.rb $ git status On branch master Changes to be committed: (use "git reset HEAD <file>..." to unstage benchmarks.rb $ git status On branch master Changes to be committed: (use "git reset HEAD <file>..." to unstage
test.txt' $ git status On branch master Changes to be committed: (use "git reset HEAD <file>..." to unstage test.txt' $ git status On branch master Changes to be committed: (use "git reset HEAD <file>..." to unstage
例如,为了解决取消暂存文件的易用性问题,可以向 Git 中添加你自己的取消暂存别名: $ git config --global alias.unstage 'reset HEAD --' 这会使下面的两个命令等价 : $ git unstage fileA $ git reset HEAD -- fileA 这样看起来更清楚一些。
并处于暂存状态: $ git status On branch master Changes to be committed: (use "git reset HEAD <file>..." to unstage 会看到下面内容: $ git status On branch master Changes to be committed: (use "git reset HEAD <file>..." to unstage CONTRIBUTING.md $ git status On branch master Changes to be committed: (use "git reset HEAD <file>..." to unstage CONTRIBUTING.md $ git status On branch master Changes to be committed: (use "git reset HEAD <file>..." to unstage 命令将会看到: $ git status On branch master Changes to be committed: (use "git reset HEAD <file>..." to unstage
) $ git status On branch master Changes to be committed: (use "git restore --staged <file>..." to unstage ) $ git status On branch master Changes to be committed: (use "git restore --staged <file>..." to unstage ) $ git status On branch master Changes to be committed: (use "git restore --staged <file>..." to unstage ) $ git status On branch master Changes to be committed: (use "git restore --staged <file>..." to unstage
但是没有执行 git commit 提交版本库 , 此时就会提示 Changes to be committed: (use "git restore --staged <file>..." to unstage to publish your local commits) Changes to be committed: (use "git restore --staged <file>..." to unstage
Changes to be committed: (use "git reset HEAD <file>..." to unstage) modified: web/Application/ Changes to be committed: (use "git reset HEAD <file>..." to unstage) modified: web/Application/
Changes to be committed: (use "git reset HEAD <file>..." to unstage) modified: web/Application/Common Changes to be committed: (use "git reset HEAD <file>..." to unstage) modified: web/Application/Mobile
查看状态: # On branch master # Changes to be committed: # (use "git reset HEAD <file>..." to unstage) # # modified: readme.txt # 这里 Git 又给出提示了: use "git reset HEAD <file>..." to unstage 用 git reset HEAD