Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -196,6 +196,7 @@ If you aren't using any zsh frameworks, or if you're a bash user, do the followi
| `git-run-command-on-revisions` | Gary Bernhardt's [dotfiles](https://github.com/garybernhardt/dotfiles) | Runs a given command over a range of Git revisions |
| `git-shamend` | Danielle Sucher's [git-shamend](http://www.daniellesucher.com/2014/05/08/git-shamend/) blog post | Amends your staged changes as a fixup (keeping the pre-existing commit message) to the specified commit, or HEAD if no revision is specified |
| `git-show-overwritten` | Mislav Marohnić's [dotfiles](https://github.com/mislav/dotfiles) | Aggregates `git blame` information about the original owners of lines changed or removed in the '<base>...<head>' diff.|
| `git-sp` | A. Schwarz's [git-sp](https://github.com/Schwarzy1/git-sp) | "Simple push", single short command to commit, and push. Use -a flag to add all files to commit.|
| `git-submodule-rm` | Greg V's [dotfiles](https://github.com/myfreeweb/dotfiles) | Allows you to remove a submodule easily with `git submodule-rm path/to/submodule` |
| `git-thanks` | Mislav Marohnić's [dotfiles](https://github.com/mislav/dotfiles) | List the contributors to a repository in descending commit order, even if their contribution has been completely replaced |
| `git-track` | Zach Holman's [dotfiles](https://github.com/holman/dotfiles) | Sets up your branch to track a remote branch. Assumes you mean origin/localbranchname |
Expand Down
39 changes: 39 additions & 0 deletions bin/git-sp
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
#!/usr/bin/env bash
#
# Author: A. Schwarz
# Usage: git sp [-a] <message>
#
# "Simple push": commit with message and push. Use -a flag to add changed files
# to commit.
#
# See https://github.com/Schwarzy1/git-sp for more information.
#


usage(){
echo "usage: git sp [-a] <message>

Commits and pushes to current working branch.
-a Run 'git add -A' prior to committing."
exit 1
}


# -a should trigger `git add -A`
while getopts 'a' flag; do
aflag='true'
done

if test "$#" -lt 1
then
usage
else
if test $aflag
then
git add -A
git commit -m "$2"
else
git commit -m "$1"
fi
git push
fi
1 change: 1 addition & 0 deletions git-extra-commands.plugin.zsh
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ zstyle ':completion:*:*:git:*' user-commands \
run-command-on-revisions:'Runs a given command over a range of Git revisions' \
shamend:'Amends your staged changes as a fixup to the specified older commit in the current branch' \
show-overwritten:"Aggregates git blame information about original owners of lines changed or removed in the '<base>...<head>' diff" \
sp:"'Simple push', commits and pushes. Use -a flag to add"\
submodule-rm:'Remove submodules from current repo' \
thanks:'List authors with commit count' \
track:'Sets up your branch to track a remote branch' \
Expand Down