I'm having git conflict while doing a rebase. I want to keep both the files from mine and theirs... Is there any way to resolve it and keep both the files?
git stash
your local change. git rebase
git stash pop
get your change You note that:
I have resolved it manually...
In fact, any resolution is manual, by definition. Git tried to resolve it automatically and failed, and stopped in the middle of the rebase. Your job is to resolve the problem. Whatever you do, Git assumes that's the right resolution. :-) Whatever you did, you did "manually".
First use mine and then use theirs... And I saved both the files
If you mean:
git checkout --ours path/to/file
cp path/to/file path/to/file.ours
git add path/to/file.ours
git checkout --theirs path/to/file
git add path/to/file
for instance, that's a correct way to keep the "ours" version under a new name and tell Git that path/to/file
should use the the "theirs" version as the resolved file.
In any case, whatever you did, Git will assume that this is the correct resolution of the problem: when Git's automatic merge fails, Git relies on you to know the right answer.
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.