Sha256: 979d95584ac8700e2cd56a5f24706749906b0ff4baa8e36f8989c240df018845

Contents?: true

Size: 503 Bytes

Versions: 36

Compression:

Stored size: 503 Bytes

Contents

#!/bin/bash
#
# git-stash-and-checkout --
# 
# Push to the stash, checkout, and pop the relevant WIP stash.
#

die() {
  echo "$@" ; exit 1
}

head=$(git symbolic-ref HEAD 2> /dev/null || git log -1 --format=%h)
current_branch=${head#refs/heads/}
target_branch=$1

git stash --include-untracked || die
git checkout $target_branch || die

stash=$(git stash list | grep "WIP on ${target_branch}:" | head -1)
stash=${stash%%:*}

if test -n "$stash" ; then
  echo "Popping $stash"
  git stash pop $stash
fi

Version data entries

36 entries across 36 versions & 1 rubygems

Version Path
git-whistles-1.4.2 libexec/git-stash-and-checkout.sh
git-whistles-1.4 libexec/git-stash-and-checkout.sh
git-whistles-1.3 libexec/git-stash-and-checkout.sh
git-whistles-1.2.1 libexec/git-stash-and-checkout.sh
git-whistles-1.2.0 libexec/git-stash-and-checkout.sh
git-whistles-1.1.3 libexec/git-stash-and-checkout.sh
git-whistles-1.1.2 libexec/git-stash-and-checkout.sh
git-whistles-1.1.1 libexec/git-stash-and-checkout.sh
git-whistles-1.1.0 libexec/git-stash-and-checkout.sh
git-whistles-1.0.2 libexec/git-stash-and-checkout.sh
git-whistles-1.0.1 libexec/git-stash-and-checkout.sh
git-whistles-0.12.0 libexec/git-stash-and-checkout.sh
git-whistles-0.10.0 libexec/git-stash-and-checkout.sh
git-whistles-0.9.1 libexec/git-stash-and-checkout.sh
git-whistles-0.9.0 libexec/git-stash-and-checkout.sh
git-whistles-0.8.2 libexec/git-stash-and-checkout.sh
git-whistles-0.8.1 libexec/git-stash-and-checkout.sh
git-whistles-0.8.0 libexec/git-stash-and-checkout.sh
git-whistles-0.7.7 libexec/git-stash-and-checkout.sh
git-whistles-0.7.6 libexec/git-stash-and-checkout.sh