Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- { BufferedProcess } = require 'atom'
- atom.commands.add 'atom-text-editor', 'undo-last-commit': (event) ->
- path = atom.workspace.getCenter().getActiveTextEditor()?.getPath()
- directory = atom.project.getDirectories().filter((d) -> d.contains(path))[0]
- output = ''
- new BufferedProcess
- command: 'git'
- args: ['reset', 'HEAD^']
- options:
- cwd: directory.getPath()
- stdout: (data) -> output += data.toString()
- stderr: (data) -> output += data.toString()
- exit: (code) ->
- if code is 0
- atom.notifications.addSuccess('Undo Last Commit', detail: output);
- else
- atom.notifications.addError('Undo Last Commit', detail: output);
Add Comment
Please, Sign In to add comment