As you're using the Github for Windows app, I'm trying to write this answer in terms that should be easy to understand for people unaccustomed to git commands.
In Github for Windows, the Sync button actually executes many git commands as described eg. in here. If the Sync button is all you've been using, the following scenario can lead into new branches and weird merge commits:
- person A has edited file xyz
- person A commits & syncs xyz into master
- person B edits file xyz without first syncing (ie. B is editing an old version of xyz)
- person B commits & tries to sync xyz
- Github for Windows attempts to automatically handle the situation
- this can lead to a new branch being created from the common startpoint of A's and B's changes, with B's commit on this new branch and A's commit on master
- this new branch will then be automatically rebased or merged (depending on conflicts & such) on master
Unfortunately, occasionally Github for Windows botches up the rebase. Then you get an error message in the GUI and need to figure out the situation in Git shell. If that is the case, usually I've found the only workaround option is aborting the rebase using git rebase --abort
, undoing B's commit from the GUI (if possible), and restoring B's workspace to the master branch that includes A's commit. Then B can re-apply her changes on the file that includes A's changes.
The Simple Person's Workflow for Github for Windows should usually be "Sync, change, commit, Sync", so that you get all the previous changes before you edit anything. Using the actual git commands in the shell is still a preferred option.