5

I am using Github GUI for Mac. Now I've some changes in my local repository, but I want to ignore them and pull latest remote repository. I tried Repository/Pull, but got Git Error.

"•error: Your local changes to the following files would be overwritten by merge: Classes/xxx.m Please, commit your changes or stash them before you can merge."

I tried Repository/Synchronize, but got following error.

"Sync Failed. Please commit all your changes before syncing."

Any idea?

ttotto
  • 826
  • 3
  • 13
  • 31

4 Answers4

5

Place a checkmark near each of the changed files, then go to the Repository menu and click Discard Changes to Selected Files.

user01380121
  • 527
  • 6
  • 18
3

If you mean using MAC GUI only, check and right click the changed files then select the discard the changes.

Leo wang
  • 46
  • 3
1

if you want to remove your uncommitted changes, just do a checkout on those files again.

Stash is super easy too though, and it keeps your changes in a local 'bucket' or stash :)

Evert
  • 93,428
  • 18
  • 118
  • 189
0

For those on Github for Windows, it is not obvious where Discard All Changes is, so I wanted to share this:

  1. Select Files by using check mark next to names.
  2. Right click on Collapse All/ Expand All button with two arrows. (This button is on right side of Files to Commit box, and under Sync and Gear icons.) This is where Discard All Changes is >hidden<.

Sorry but too low level to add comment to @Leo wangs or @aspiringwebdev chain above. You gotta start somewhere...

micstr
  • 5,080
  • 8
  • 48
  • 76
  • Github for Windows instructions can be found at https://stackoverflow.com/questions/24975043/rollback-uncommited-changes-in-github-for-windows – Mark Cramer May 03 '17 at 02:57