Git: 文件被检出覆盖
Git: files overwritten by checkout
我想结账一个分支,我收到了这条消息
error: Your local changes to the following files would be overwritten by checkout:
src/main/webapp/data/GuerrillaLabels.json
Please, commit your changes or stash them before you can switch branches.
Aborting
但我希望这些文件被覆盖
git结帐
https://git-scm.com/docs/git-checkout#git-checkout---force
您可以传递 -f
(强制)标志以强制签出分支,这将清除您所做的尚未提交的所有更改。
git checkout -f branch
如果您不想丢失所有更改,您可以使用以下方法签出该文件:
git checkout -- src/main/webapp/data/GuerrillaLabels.json
git 隐藏
https://git-scm.com/book/en/v1/Git-Tools-Stashing
您还可以存储您所做的更改,稍后使用
重新应用它们
git stash
您可以使用
查看您的收藏
git stash list
您可以使用 pop
应用这些存储。不向 pop
传递任何内容将应用最后一个隐藏的项目。
git stash pop
注意:此方法可能会导致与代码冲突。
我想结账一个分支,我收到了这条消息
error: Your local changes to the following files would be overwritten by checkout:
src/main/webapp/data/GuerrillaLabels.json
Please, commit your changes or stash them before you can switch branches.
Aborting
但我希望这些文件被覆盖
git结帐
https://git-scm.com/docs/git-checkout#git-checkout---force
您可以传递 -f
(强制)标志以强制签出分支,这将清除您所做的尚未提交的所有更改。
git checkout -f branch
如果您不想丢失所有更改,您可以使用以下方法签出该文件:
git checkout -- src/main/webapp/data/GuerrillaLabels.json
git 隐藏
https://git-scm.com/book/en/v1/Git-Tools-Stashing
您还可以存储您所做的更改,稍后使用
重新应用它们git stash
您可以使用
查看您的收藏git stash list
您可以使用 pop
应用这些存储。不向 pop
传递任何内容将应用最后一个隐藏的项目。
git stash pop
注意:此方法可能会导致与代码冲突。