'Git back merge shows files deleted in sandbox
I am working on a feature that has many new files(eg A.class,B.class,C.class) added in sandbox X.
I have merged my sandbox branch X to master and due to some issue, I reverted the merge to master.
Now the files(eg A.class,B.class,C.class) will be deleted in master and the same files will be present in sandbox.
now i am trying to back merge master to sandbox, the files show as delete.
I have around 200 newly added files and lot of changes in existing files too. I know this is how it should work. But i need those files in sandbox and my back merge should not delete the files in sandbox.
My work around is to update newly added files in sandbox X with some changes like space and then will back merge from master so that it shows conflict and will accept sandbox X files while resolving conflict.
Is there any easy way to do it?
Solution 1:[1]
Ideally, you would not merge master back to X.
If you are the only one working on X, you would rebase X on top of master: your files would be preserved, would not show as deleted then.
git switch X
git rebase master
git push --force # OK if you were the only one working on X
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | VonC |
