Guest User

Untitled

a guest
Nov 19th, 2017
96
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.66 KB | None | 0 0
  1. { BufferedProcess } = require 'atom'
  2.  
  3. atom.commands.add 'atom-text-editor', 'undo-last-commit': (event) ->
  4. path = atom.workspace.getCenter().getActiveTextEditor()?.getPath()
  5. directory = atom.project.getDirectories().filter((d) -> d.contains(path))[0]
  6. output = ''
  7. new BufferedProcess
  8. command: 'git'
  9. args: ['reset', 'HEAD^']
  10. options:
  11. cwd: directory.getPath()
  12. stdout: (data) -> output += data.toString()
  13. stderr: (data) -> output += data.toString()
  14. exit: (code) ->
  15. if code is 0
  16. atom.notifications.addSuccess('Undo Last Commit', detail: output);
  17. else
  18. atom.notifications.addError('Undo Last Commit', detail: output);
Add Comment
Please, Sign In to add comment