Force git to overwrite local files on pull 使用pull强制覆盖本地文件 转载自:http://snowdream.blog.51cto.com/3027865/1102441

时间:2023-03-10 06:02:40
Force git to overwrite local files on pull 使用pull强制覆盖本地文件 转载自:http://snowdream.blog.51cto.com/3027865/1102441

How do I force an overwrite of local files on a git pull?

I think this is the right way:

$ git fetch --all  $ git reset --hard origin/master 

$ git fetch downloads the latest from remote without trying to merge or rebase anything. Then the $git reset resets the master branch to what you just fetched.

Careful anyone. This will remove all the local files.