How to deal with a Git conflict when the file on the remote repository must be changed
1 visualizzazione (ultimi 30 giorni)
Mostra commenti meno recenti
I have a remote repository and two sandboxes representing two different users. Let user 1 and user 2 edit the same file, where user 1 pushes his file to the remote repository first. When user 2 tries to push his edited file, there is naturally an error since the file on the remote repository has been changed. By first fetching and then merging with the remote repository, the conflict is discovered and must be dealt with. The conflict can be deal with by right clicking on the conflicted file to compare the code. By using the button "Swap sides" you can choose which code that is the correct one, and then press merge to merge the code. Now I get two cases:
Case 1: The code on the repository is correct: Then it is straight forward to merge the code, mark the conflict as resolved and push the code the the remote repository.
Case 2: When the local sandbox has the correct code: I choose swich sides in the comparison of the code, and merges the code with my correct code. I can now mark the conflict as resolved, but now I get some troubles. When I now try to push the data I get the error "The remote update was rejected by the target: refs/heads/master->refs/remotes/origin/master. Unable to perform fast forward merge on target. Please pull or fetch and merge manually".
If I try to merge the data, I obtain: "Fatal: You have not concluded your merge (MERGE_HEAD exists), Please Commit your changes before you can merge". Since I have not edited my own file (since it was correct when the conflict started) I am not able to commit the changes.
So my question is: How can you resolve a conflict where you want to overwrite the code that is on the remote repository ?
0 Commenti
Risposte (0)
Vedere anche
Categorie
Scopri di più su Git in MATLAB in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!