-1

I need to merge my master branch with my development branch but there are soooo many conflicts as I have been working on the master and not updating the development branch.

Is there a quick way to resolve these? I simply want my development branch to be a copy of the master and am not too fussed about keeping the commits etc but am unable to delete the dev branch and start again.

I looked into doing a rebase but would have the same issues with conflicts.

UDATE**

Disaster!! Now I am unable to switch back to the master branch because of all the conflicts. I have tried stashing the merge but that gave an error. So I then used the 'Discard' button and discarded the file changes hoping this would go back to how it was but now when I try to checkout master I get the error, "The following untracked working tree files would be overwritten by checkout:".

Can anyone help me out? First and foremost I need to be able to switch to master. Forget about the merge!

GadaaDhaariGeek
  • 971
  • 1
  • 14
  • 33
LeeTee
  • 6,401
  • 16
  • 79
  • 139
  • 1
    If you don't care about the changes on the development branch then just remove it and start over. – axiac Dec 04 '17 at 12:39
  • Unfortuantley I'm not allowed to remove the dev branch :( Do you have any other suggestions? Many thanks – LeeTee Dec 04 '17 at 14:24
  • Disaster!! Now I am unable to switch back to the master branch because of all the conflicts. I have tried stashing the merge but that gave an error. So I then used the 'Discard' button and discarded the file changes hoping this would go back to how it was but now when I try to checkout master I get the error, "The following untracked working tree files would be overwritten by checkout:". I'm in a pickle!! :( – LeeTee Dec 04 '17 at 14:39
  • 1
    You are in the middle of an unfinished merge. You have to run [`git merge --abort`](https://git-scm.com/docs/git-merge#git-merge---abort) first. I don't have a copy of SourceTree at hand and I cannot remember if it provides such a command (it should be in the main menu). In case you cannot find it, open the terminal (it's a button on the right hand side of the toolbar) and type the command there. Then return to SourceTree and make it refresh the repository info. – axiac Dec 04 '17 at 14:49
  • Ive run that script but still cannot switch to master :( – LeeTee Dec 04 '17 at 15:12

1 Answers1

1

Disaster!! Now I am unable to switch back to the master branch because of all the conflicts. I have tried stashing the merge but that gave an error. So I then used the 'Discard' button and discarded the file changes hoping this would go back to how it was but now when I try to checkout master I get the error, "The following untracked working tree files would be overwritten by checkout:". I'm in a pickle!! :(

Run git merge --abort to put yourself back into the state you were before the conflicts appeared.

I simply want my development branch to be a copy of the master and am not too fussed about keeping the commits etc.

If you're not fussed about keeping the commits, you could just copy the files in master to a temporary location, checkout development then paste the contents of the temporary directory into your repository workspace?

Edmund Dipple
  • 2,244
  • 17
  • 12
  • thanks for your quick response. I have opened the terminal in sourectree and run the command. So now I am no longer in the middle of a merge, however, when I try switching to master I get the same error, 'The following untracked working tree files would be overwritten by checkout:' – LeeTee Dec 04 '17 at 14:56
  • @LeeTee `git status` will tell you which files git is concerned about. – JDB Dec 04 '17 at 14:57
  • Ive added a screen grab of the error above. Thsi error is exact same as previous to running git merge --abort – LeeTee Dec 04 '17 at 15:06
  • Run `git stash` to save your workspace changes, then change branches. – Edmund Dipple Dec 04 '17 at 15:58
  • Strange, I just committed the files in develop and it allowed me to switch to Master, Phew!! I will do what you suggested and copy and paste the files from master to develop. Thanks – LeeTee Dec 04 '17 at 16:17
  • Apologies, I didn't notice at first that those files weren't being tracked by git. `git stash` won't touch any untracked files. – Edmund Dipple Dec 04 '17 at 16:19