diff --git a/lib/git-plus-commands.coffee b/lib/git-plus-commands.coffee index 7a3bf79..a441870 100644 --- a/lib/git-plus-commands.coffee +++ b/lib/git-plus-commands.coffee @@ -42,6 +42,7 @@ getCommands = -> git.refresh() commands = [] commands.push ['git-plus:add', 'Add', -> GitAdd(repo)] + commands.push ['git-plus:add-modified', 'Add Modified', -> git.addModified(repo).then -> GitCommit(repo)] commands.push ['git-plus:add-all', 'Add All', -> GitAdd(repo, addAll: true)] commands.push ['git-plus:log', 'Log', -> GitLog(repo)] commands.push ['git-plus:log-current-file', 'Log Current File', -> GitLog(repo, onlyCurrentFile: true)] diff --git a/lib/git-plus.coffee b/lib/git-plus.coffee index e5dbde2..9b2ef2e 100644 --- a/lib/git-plus.coffee +++ b/lib/git-plus.coffee @@ -108,6 +108,7 @@ module.exports = @subscriptions.add atom.commands.add 'atom-workspace', 'git-plus:init', -> GitInit() @subscriptions.add atom.commands.add 'atom-workspace', 'git-plus:menu', -> new GitPaletteView() @subscriptions.add atom.commands.add 'atom-workspace', 'git-plus:add', -> git.getRepo().then((repo) -> GitAdd(repo)) + @subscriptions.add atom.commands.add 'atom-workspace', 'git-plus:add-modified', -> git.getRepo().then((repo) -> git.addModified(repo).then -> GitCommit(repo)) @subscriptions.add atom.commands.add 'atom-workspace', 'git-plus:add-all', -> git.getRepo().then((repo) -> GitAdd(repo, addAll: true)) @subscriptions.add atom.commands.add 'atom-workspace', 'git-plus:commit', -> git.getRepo().then((repo) -> GitCommit(repo)) @subscriptions.add atom.commands.add 'atom-workspace', 'git-plus:commit-all', -> git.getRepo().then((repo) -> GitCommit(repo, stageChanges: true)) diff --git a/lib/git.coffee b/lib/git.coffee index b33a5a6..c0d93ef 100644 --- a/lib/git.coffee +++ b/lib/git.coffee @@ -119,6 +119,14 @@ module.exports = git = notifier.addSuccess "Added #{file ? 'all files'}" .catch (msg) -> notifier.addError msg + addModified: (repo) -> + args = ['add', '-u'] + git.cmd(args, cwd: repo.getWorkingDirectory()) + .then (output) -> + if output isnt false + notifier.addSuccess "Added #{file ? 'all files'}" + .catch (msg) -> notifier.addError msg + getRepo: -> new Promise (resolve, reject) -> getRepoForCurrentFile().then (repo) -> resolve(repo) diff --git a/menus/git-plus.cson b/menus/git-plus.cson index 4a134b7..8157c64 100644 --- a/menus/git-plus.cson +++ b/menus/git-plus.cson @@ -17,6 +17,10 @@ 'label': 'Add' 'command': 'git-plus:add' } + { + 'label': 'Add Modified' + 'command': 'git-plus:add-modified' + } { 'label': 'Add All' 'command': 'git-plus:add-all' diff --git a/package.json b/package.json index b79367f..2652377 100644 --- a/package.json +++ b/package.json @@ -10,6 +10,7 @@ "atom-workspace": [ "git-plus:menu", "git-plus:add", + "git-plus:add-modified", "git-plus:add-all", "git-plus:add-all-and-commit", "git-plus:add-all-commit-and-push",