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

前端 未结 11 1133
野性不改
野性不改 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:46

    If the above commands didn't help you use this method:

    1. Go to the git archive where you have Fork
    2. Click Settings> Scroll down and click Delete this repository
    3. Confirm delete
    4. Fork again, and re-enter the git clone <url_git>
    5. You already have the latest version
    0 讨论(0)
  • 2021-01-29 17:49

    You have to merge your files first. Do a git status to see what are the files that need to be merged (means you need to resolve the conflicts first). Once this is done, do git add file_merged and do your pull again.

    0 讨论(0)
  • 2021-01-29 17:49

    It sounds to me like you're having core.autocrlf-problems. core.autocrlf=true can give problems like the ones you describe on Windows if CRLF newlines were checked into the repository. Try disabling core.autocrlf for the repository, and perform a hard-reset.

    0 讨论(0)
  • 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.

    0 讨论(0)
  • 2021-01-29 17:54

    I understand you want to trash your local changes and pull down what's on your remote?

    If all else fails, and if you're (quite understandably) scared of "reset", the simplest thing is just to clone origin into a new directory and trash your old one.

    0 讨论(0)
提交回复
热议问题