Search code examples
githubgithub-for-windows

GitHub - Desktop App Inserts Text Into My Code When I Sync


When I sometimes use the GitHub Desktop App and Sync to get whatever changes were made to repo, it inserts strings into my code like this:

>>>>>>> origin/master

Why is it doing this? I haven't found anything online that talks about this problem. Am I using the app right? The same thing happens to my coding partners as well.


Solution

  • >>>>>>> origin/master is a merge marker, which is Git's way of representing merge conflicts in a versioned file. In the course of updating your local master branch it can the case that a change you pulled in from the remote conflicts with the version you have locally. One example would be a method or function which both you and someone else in your team modified. Git will first try to automatically resolve this conflict. But if it cannot, then you will see something looking like the following:

    <<<<<<< HEAD
    // your local version
    =======
    // remote version
    >>>>>>> origin/master
    

    To resolve this you can use a merge conflict tool. If you wish to resolve by hand, then you should choose which version you want, possibly modify that as well, and then delete all the markers (i.e. delete <<<<<<<, =======, and >>>>>>>).