I am using Atom editor on Windows 7. On the git shell when I run the command, git reset --hard
, all the other editors reset/undo all the modified files. but if I am using ATOM editor, changes are retained. If I try to close the file in editor, Atom ask, file is changed, do you want to save the changes.
How can I force Atom to undo changes when files are modified externally.
According to https://discuss.atom.io/t/auto-reload-changed-files/8451/6, FileWatcher is an Atom package which will do what you want.
A simple solution that works:
1) Just close the file being edited
2) Click "File->Reopen Last Item" to re-open it
Bingo!
For Atom versions 1.29+, you can just click "Fetch" on the bottom-right corner of the editor.
In order to manually force the reload of a file, paste the following lines in your init.coffee
file (from here):
atom.commands.add "atom-workspace", "custom:revert-to-disk", ->
atom.workspace.getActiveTextEditor().buffer.reload()
In your keymap.cson
file, paste the following:
'atom-workspace':
'f5': 'custom:revert-to-disk
Whenever a file has changed and is not automatically reloaded, go to the tab and press F5. The file is immediately reverted to the disk state without prompt. So be careful, any manual changes (if any) are also irrecoverably lost, but that is the purpose of any revert-to-disk-state functionality.
The init.coffee
file is located in/ can be opened from Atom via (from here):
- Linux:
~/.atom/init.coffee
; open in Atom from Edit
> Init.Script
- Mac:
~/.atom/init.coffee
; open in Atom from Atom
> Init.Script
- Windows:
%USERPROFILE%\.atom\init.coffee
; open in Atom from File
> Init.Script
The keymap.cson
file is located in/ can be opened from Atom via (from here):
- Linux:
~/.atom/keymap.cson
; open in Atom from Edit
> Keymap
- Mac:
~/.atom/keymap.cson
; open in Atom from Atom
> Keymap
- Windows:
%USERPROFILE%\.atom\keymap.cson
; open in Atom from File
> Keymap