git restore .
git restore --staged .
git reset .
git fetch --all
git reset --hard origin/master
git pull // 这一步为了同步远程代码,不需要的话可不执行
stash 暂存(推荐)
git add .
git stash
git pull
git stash pop 本文介绍了三种使用 Git 放弃本地修改并强制拉取更新的方法:使用`git restore`、`git reset`以及`git stash`。
git restore .
git restore --staged .
git reset .
git fetch --all
git reset --hard origin/master
git pull // 这一步为了同步远程代码,不需要的话可不执行
stash 暂存(推荐)
git add .
git stash
git pull
git stash pop