撤消git中未暂存的更改(主分支)
我有一个主分支,有人对它做了一些我不想要的更改。是否可以在不提交的情况下撤消更改 当前状态:撤消git中未暂存的更改(主分支),git,github,Git,Github,我有一个主分支,有人对它做了一些我不想要的更改。是否可以在不提交的情况下撤消更改 当前状态: git status On branch master Changes not staged for commit: (use "git add <file>..." to update what will be committed) (use "git checkout -- <file>..." to discard changes in working direct
git status
On branch master
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: bazinga.php
modified: bazinga2.php
no changes added to commit (use "git add" and/or "git commit -a")
git状态
论分行行长
未为提交而暂存的更改:
(使用“git add…”更新将提交的内容)
(使用“git签出--…”放弃工作目录中的更改)
修改:bazinga.php
修改:bazinga2.php
未向提交添加任何更改(使用“git add”和/或“git commit-a”)
因此基本上恢复到旧的bazinga/bazinga2文件。一个答案隐藏在git状态信息中 (使用“git签出--…”放弃工作目录中的更改) 尝试使用下面的命令
git checkout bazinga.php
git checkout bazinga2.php
可以将分支设置为与远程分支完全匹配
git fetch origin
git reset --hard origin/master
或
参考:
git checkout .