Not really a meditation this is but more of shell scripting code contribution related to git ...

# Some git commands for use in bourne-like shells; # some could be aliases. gshow_old_branch() { local old old=$( git branch ) printf "## Moving from %s\n" "${old}" >&2 } gmerge() { git mergetool } gcon() { git rebase --continue } gskip() { git rebase --skip } gabort() { git rebase --abort } ghard() { git reset --hard $@ } gwhere() { git branch } ghelp() { git "${1}" --help } gadjust() { git rebase -i $@ } grephrase() { git commit --amend } gcd() { case $# in 0 ) printf "Need a branch to change to\n" >&2 return 1 ;; * ) git checkout "$1" ;; esac } gupdate() { gshow_old_branch git checkout master \ && git pull --rebase } gplop() { case $# in 0 | 1 ) printf "Need a branch to change and a branch to rebase on\n" >&2 exit 1 ;; * ) ;; esac set +x local in="$1" local out="$2" git checkout "$out" && git rebase "$in" [ $? -eq 0 ] || return case $# in 2 ) ;; * ) shift shift set -- $out $@ set +x gplop $@ ;; esac } glastmerge() { git ci -a -m '# (merge with previous)' \ && git rebase -i HEAD^^ } gpick() { for m in $@ do git cherry-pick "${m}" || break done } gitm() { date='last 5 months' gitk --all --date-order --since="$date" $@ } gdiff() { git diff $@ } gpatch() { git diff --no-color $@ } gmovetag() { local tag pos case $# in 0 | 1 ) printf "Need both an tag to move and the new location.\n" >&1 exit 1 ;; * ) tag="${1}" pos="${2}" ;; esac set +x git tag -d "${tag}" git tag -a "${tag}" "${pos}" -m 'Reset mark.' set +x }

Let me know please if comments may be needed for some of the functions.


In reply to OT - git related bourne-like shell functions by parv

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.