1

I'm absolutely new in Git (but everyone once was a newbie, right?). I had two branches : master and nightly_build. After finishing work with nightly_build i decided to merge it with master I did with TortoiseGit "git checkout master" and then ran

git.exe merge nightly_build

I got the following:

    Updating 6762fd0..fa1963c  
    error: Your local changes to the following files would be overwritten by merge:
    obj/x86/Release/DesignTimeResolveAssemblyReferences.cache
    Please commit your changes or stash them before you merge.
    Aborting
    git did not exit cleanly (exit code 1)

This .cache file is negligible, I can delete it to avoid this warning. But would it proper way?

What I have to do in order to successfully merge my changes in nightly_build with master? There's no difference: console or GUI commands. Any advice from expierenced Git people would be appreciated.

Yue Lin Ho
  • 2,945
  • 26
  • 36
Alex Rsk
  • 93
  • 1
  • 7
  • 1
    The error message literally told you what to do, commit or stash your changes before you merge. It cannot merge while there are uncommitted changes in your repository since those changes would be overwritten by the merge, which it won't do. So what should you do? Commit or stash your changes, then retry the merge. – Lasse V. Karlsen May 04 '18 at 07:01
  • Possible duplicate of [How do I resolve git saying "Commit your changes or stash them before you can merge"?](https://stackoverflow.com/questions/15745045/how-do-i-resolve-git-saying-commit-your-changes-or-stash-them-before-you-can-me) – Robin Green May 04 '18 at 07:22

2 Answers2

1

If you don't care about your local changes and want to remove them from your working directory, one solution would be to stash them using git stash, for example:

git checkout master
git stash
git merge nightly_build
Hamza El Aoutar
  • 5,292
  • 2
  • 17
  • 23
0

Do this:

git mergetool

Hopefully, now you should see tortoise git pop up with a diff of the conflict, or some other gui. If you have not set up a visual difftool, then look up how to set one up for tortoise git. I just did and this is what I found.

Fix the conflicts, and save your changes, then do:

git commit -am 'Your commit message here'
git push
smac89
  • 39,374
  • 15
  • 132
  • 179