0

I ran git pull origin master and I get the following message because I have my changes in a single file. What command should I issue so that the changes are overwritten on my local copies.

  • branch master -> FETCH_HEAD Updating 7sc4344..c81c437 error: Your local changes to 'foo.txt' would be overwritten by merge. Aborting. Please, commit your changes or stash them before you can merge.
Jason
  • 12,229
  • 20
  • 51
  • 66

2 Answers2

3

You can try checking out the file so that your changes are removed with git checkout -- foo.txt and then you'll no longer have changes so the merge should go through.

To change everything back to normal, do git reset --hard HEAD

Jorge Israel Peña
  • 36,800
  • 16
  • 93
  • 123
  • I have many such files in several other directories, is there a command to overwrite all such changes. – Jason Sep 12 '11 at 03:48
2

Look at this: How do I force "git pull" to overwrite local files?

git clean
git pull
Community
  • 1
  • 1
Rahul
  • 1,866
  • 17
  • 32