Search code examples
gitvisual-studiobitbucketteam-explorer

Visual Studio reject others' commit


I'm using a Bitbucket repo with 2 others and we develop a small project together. me and another teammate committed changed in the same time and now none of us can commit, because we would have to pull (not just fetch) beforehand, but that would erase our work. I added the other teammate's code into mine so I have the "correctly merged" version on my side, but to commit I would have to erase the other commit.

Question is, how to do that in VS 2015 team explorer?

Edit

Forcing the latest commit to "take over" the branch is also fine. Is there a way to do that?


Solution

  • If your project is under version control (in your case, Bitbucket), then it's logical that if a peer is checking some file you're currently working on, and you'll try to check that file in after your peer did, then you'd have to MERGE the files so that you don't overwrite your peer's work.

    If you work on two different files, then you won't have to merge since it's two different files, but the best practice is to always get the latest version of the code before checking in, to ensure you don't break the code.

    Hope that makes sense. If not, let me know and I'll try to clarify.