I want to git pull from the remote origin and want to keep my local changes and want to ignore remote changes in conflicted files only. Is there any way to do it by Git?
I have one option that I backup my local files and after pull, override them with the conflicted files. But I want to achieve this by using git.
Instead of git pull
, You can use git rebase
to resolve conflict. It will not merge remote code into your branch, instead it will give one by one step to resolve conflicts.
With stash
and merge
this should work (I don't know if you want call this a dirty solution 😉):
git stash
--include-untracked
too) git pull
git merge -X theirs --no-commit --no-ff stash
git reset -- .
git merge --abort
git stash pop
in case you need your untracked files too
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.