1.git pull强制覆盖本地

  1. # 拉取代码
  2. git fetch --all
  3. # 然后,你有两个选择:
  4. git reset --hard origin/master

2.git pull不覆盖本地

  1. # 缓存本地代码
  2. git stash
  3. # 拉取代码
  4. git pull
  5. # 将缓存代码放回本地
  6. git stash pop
  7. # 代码上传
  8. git add .
  9. git commit -m '内容'
  10. git push