git: How do I get the latest version of my code?

前端 未结 11 1248
野性不改
野性不改 2021-01-29 17:08

I\'m using Git 1.7.4.1. I want to get the latest version of my code from the repository, but I\'m getting errors ...

$ git pull
….
M   selenium/ant/build.proper         


        
11条回答
  •  悲&欢浪女
    2021-01-29 17:52

    I suspect that what's happened may be that you've deleted the files that you modified (because you didn't care about those changes) and now git is taking the deletion to be a change.

    Here is an approach that moves your changes out of your working copy and into the "stash" (retrievable should it actually turn out that you ever need them again), so you can then pull the latest changes down from the upstream.

    git stash  
    git pull
    

    If you ever want to retrieve your files (potential conflicts with upstream changes and all), run a git stash apply to stick those changes on top of your code. That way, you have an "undo" approach.

提交回复
热议问题