How do I resolve a conflict after git pull?

前端 未结 5 1881
走了就别回头了
走了就别回头了 2020-12-05 06:22

I have to solve some conflict after a git pull.

$ git pull
CONFLICT (rename/add): Renamed vignette_generator_mashed.h->vision_problem_8.h in          


        
5条回答
  •  余生分开走
    2020-12-05 06:58

    If you have a proper branching strategy - aka features are merged into develop , just before merge rebased etc. , most often when you want to run a git pull on a branch you basically want to get all the new stuff from the git server, and late on apply your own stuff , which is git lingua franca is something like this:

    # put all my changes on the stash 
    git stash 
    
    # fully reset the current branch to the state it is on the server
    git clean -d -x -f ; git reset HEAD --hard ; git pull --force
    
    # apply your own changes 
    git stash pop
    

    You could also instead of stash put you current state into a tmp branch ... but eventually if there are conflicts you would have to manually resolve them ...

提交回复
热议问题