Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/git/25.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
撤消git中未暂存的更改(主分支)_Git_Github - Fatal编程技术网

撤消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 .