38

How to discard all changes in Github desktop (mac), comparing to the latest commit?

It is possible to click on one file and select "discard changes". But how to discard all changes in files?

Jonathan Rauch
  • 693
  • 1
  • 8
  • 18
Vitalii Vasylenko
  • 4,776
  • 5
  • 40
  • 64

4 Answers4

78

Just in case anyone is interested, it can be done via GitHub's Menu Bar: Repository/Discard changes to selected files.

Vitalii Vasylenko
  • 4,776
  • 5
  • 40
  • 64
  • 3
    I don't see this on Github Desktop version 1.0.10 (Windows), but Jonathan's answer worked for me. Right click on 'N changed files' at the top of the changed files list, and you'll find the option to 'Discard All Changes' – Andrew Dec 07 '17 at 00:31
  • @Andrew As tag says, its for Mac version. – Vitalii Vasylenko Dec 07 '17 at 16:46
  • 1
    It doesn't work already. Now you need to right click on `changed files`. As Jonathan said below. – guar47 Mar 24 '18 at 12:53
11

Right click on any file and you'll find the option to 'Discard All Changes':

enter image description here

Jonathan
  • 13,947
  • 17
  • 94
  • 123
3

If anyone would be interested to do this without Github Desktop, since I got to this page by searching;

"How discard all changes work in Github Desktop?"

Just run the command below in your project folder from terminal:

git reset --hard
emrepun
  • 2,496
  • 2
  • 15
  • 33
  • In 2022 I would use `git restore` which is commit history immutable, rather than `git reset --hard` that would be commit history mutable : any mutable operations are not recommended, especially for beginners who understand very little on how Git works ! – projektorius96 Oct 23 '22 at 17:12
2

Use

git checkout .

to revert local changes and add a

git pull 

to fetch the latest code from remote

Eike
  • 620
  • 4
  • 6