我是Git环境的新手,我在Mac上使用BitBucket和SourceTree。我现在要做的就是放弃自上次提交以来所做的更改。我该怎么做呢?我还没有找到像“放弃更改”这样的东西,直接从最后一次提交中提取似乎不起作用。使用GUI或命令行完成的解决方案都很好。
发布于 2015-12-17 23:29:52
在未暂存的文件上,单击右侧的三个点。单击它后,将出现一个弹出菜单,您可以在该菜单上单击Discard file
。
发布于 2013-11-27 14:02:43
好的,我只是注意到我的问题已经在问题标题中得到了回答。
要取消暂存文件,请使用
git reset HEAD /file/name
和撤消对文件的更改
git checkout -- /file/name
如果文件夹中有一批文件,则可以撤消整个文件夹
git checkout -- /folder/name
请注意,当您使用git status
命令时,所有这些命令都已显示
在这里,我创建了一个虚拟存储库,并列出了所有3种可能性
# On branch master
# Changes to be committed:
# (use "git reset HEAD <file>..." to unstage)
#
# modified: test
#
# 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: test2
#
# Untracked files:
# (use "git add <file>..." to include in what will be committed)
#
# test3
发布于 2013-11-28 01:21:21
从资源树gui中单击工作目录,右键单击要丢弃的文件,然后单击丢弃。
https://stackoverflow.com/questions/20234523
复制相似问题