Git Pull While Ignoring Local Changes?

前端 未结 12 1725
醉话见心
醉话见心 2020-12-04 04:29

Is there a way to do a git pull that ignores any local file changes without blowing the directory away and having to perform a git clone?

12条回答
  •  自闭症患者
    2020-12-04 04:59

    You just want a command which gives exactly the same result as rm -rf local_repo && git clone remote_url, right? I also want this feature. I wonder why git does not provide such a command (such as git reclone or git sync), neither does svn provide such a command (such as svn recheckout or svn sync).

    Try the following command:

    git reset --hard origin/master
    git clean -fxd
    git pull
    

提交回复
热议问题