From a36b7f4934b13a366e95175c498817015d918310 Mon Sep 17 00:00:00 2001 From: Chris Hall Date: Wed, 4 Feb 2015 11:52:23 -0500 Subject: [PATCH] adding git-chore --- bin/git-chore | 15 +++++ etc/bash_completion.sh | 8 ++- man/git-chore.1 | 47 +++++++++++++++ man/git-chore.html | 126 +++++++++++++++++++++++++++++++++++++++++ man/git-chore.md | 41 ++++++++++++++ 5 files changed, 235 insertions(+), 2 deletions(-) create mode 100644 bin/git-chore create mode 100644 man/git-chore.1 create mode 100644 man/git-chore.html create mode 100644 man/git-chore.md diff --git a/bin/git-chore b/bin/git-chore new file mode 100644 index 0000000..d4030f8 --- /dev/null +++ b/bin/git-chore @@ -0,0 +1,15 @@ +#!/usr/bin/env bash + +if test "$1" = "finish"; then + test -z $2 && echo "chore required." 1>&2 && exit 1 + branch=chore/$2 + git merge --no-ff $branch && git delete-branch $branch +else + test -z $1 && echo "chore required." 1>&2 && exit 1 + if test -n "$2"; then + echo "too many arguments; if not finishing a chore, only of new chore is expected" && exit 1 + fi + branch=chore/$1 + git checkout -b $branch &> /dev/null + test -n $? && git checkout $branch &> /dev/null +fi diff --git a/etc/bash_completion.sh b/etc/bash_completion.sh index 342c4d5..3c6dffc 100644 --- a/etc/bash_completion.sh +++ b/etc/bash_completion.sh @@ -8,10 +8,14 @@ _git_changelog(){ __gitcomp "-l -t --list --tag --no-merges" } +_git_chore(){ + __git_extras_workflow "chore" +} + _git_contrib(){ -# git completion function modified from +# git completion function modified from # https://github.com/markgandolfo/git-bash-completion/blob/master/git-completion.bash - contributors="$(git shortlog -s | cut -f2)" + contributors="$(git shortlog -s | cut -f2)" local all c s=$'\n' IFS=$'\n' local cur="${COMP_WORDS[COMP_CWORD]}" for c in $contributors; do diff --git a/man/git-chore.1 b/man/git-chore.1 new file mode 100644 index 0000000..ce32d37 --- /dev/null +++ b/man/git-chore.1 @@ -0,0 +1,47 @@ +.\" generated with Ronn/v0.7.3 +.\" http://github.com/rtomayko/ronn/tree/0.7.3 +. +.TH "GIT\-CHORE" "1" "February 2015" "" "" +. +.SH "NAME" +\fBgit\-chore\fR \- Create chore branch +. +.SH "SYNOPSIS" +\fBgit\-chore\fR [finish] +. +.SH "DESCRIPTION" +Create the given chore branch +. +.SH "OPTIONS" + +. +.P +Merge and delete the chore branch\. +. +.P + +. +.P +The name of the chore branch\. +. +.SH "EXAMPLES" +. +.nf + +$ git chore chore\-123456 +\.\.\. +$ git commit \-m "Some changes" +\.\.\. +$ git checkout master +$ git chore finish chore\-123456 +. +.fi +. +.SH "AUTHOR" +Written by Chris Hall <\fIchristopher\.k\.hall@gmail\.com\fR> from bug/feature/refactor comamnds originally written by Jesús Espino <\fIjespinog@gmail\.com\fR> +. +.SH "REPORTING BUGS" +<\fIhttps://github\.com/tj/git\-extras/issues\fR> +. +.SH "SEE ALSO" +<\fIhttps://github\.com/tj/git\-extras\fR> diff --git a/man/git-chore.html b/man/git-chore.html new file mode 100644 index 0000000..c7196b1 --- /dev/null +++ b/man/git-chore.html @@ -0,0 +1,126 @@ + + + + + + git-chore(1) - Create chore branch + + + + +
+ + + +
    +
  1. git-chore(1)
  2. +
  3. +
  4. git-chore(1)
  5. +
+ +

NAME

+

+ git-chore - Create chore branch +

+ +

SYNOPSIS

+ +

git-chore [finish] <name>

+ +

DESCRIPTION

+ +

Create the given chore branch

+ +

OPTIONS

+ +

<finish>

+ +

Merge and delete the chore branch.

+ +

<name>

+ +

The name of the chore branch.

+ +

EXAMPLES

+ +
$ git chore chore-123456
+...
+$ git commit -m "Some changes"
+...
+$ git checkout master
+$ git chore finish chore-123456
+
+ +

AUTHOR

+ +

Written by Chris Hall <christopher.k.hall@gmail.com> from bug/feature/refactor comamnds originally written by Jesús Espino <jespinog@gmail.com>

+ +

REPORTING BUGS

+ +

<https://github.com/tj/git-extras/issues>

+ +

SEE ALSO

+ +

<https://github.com/tj/git-extras>

+ + +
    +
  1. +
  2. February 2015
  3. +
  4. git-chore(1)
  5. +
+ +
+ + diff --git a/man/git-chore.md b/man/git-chore.md new file mode 100644 index 0000000..544c781 --- /dev/null +++ b/man/git-chore.md @@ -0,0 +1,41 @@ +git-chore(1) -- Create chore branch +=============================== + +## SYNOPSIS + +`git-chore` [finish] <name> + +## DESCRIPTION + + Create the given chore branch + +## OPTIONS + + <finish> + + Merge and delete the chore branch. + + <name> + + The name of the chore branch. + +## EXAMPLES + + $ git chore chore-123456 + ... + $ git commit -m "Some changes" + ... + $ git checkout master + $ git chore finish chore-123456 + +## AUTHOR + +Written by Chris Hall <> from bug/feature/refactor comamnds originally written by Jesús Espino <> + +## REPORTING BUGS + +<> + +## SEE ALSO + +<>