Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[RFC] Emojification 🦄 #43

Merged
merged 7 commits into from Oct 17, 2016
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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
8 changes: 4 additions & 4 deletions branch
Expand Up @@ -52,15 +52,15 @@ fi

# If local exists already, switch to it
if [ -n "$local_branch_exists" ] && [ ! "$local_branch_exists" == '' ]; then
echo "Switching to existing local branch..."
echo "👓 Switching to existing local branch..."
git checkout $branch

# Track remote branch if not already
if [ -n "$remote_branch_exists" ] && [ ! "$remote_branch_exists" == '' ]; then
tracking=$(git branch -vv | grep "*" | awk '{ print $4 '})
# echo "Remote branch exists. Local branch is tracking: $tracking"
if [[ ! "$tracking" =~ "$remote" ]]; then
echo "Your local branch is not tracking the corresponding remote branch, fixing..."
echo "⚒️ Your local branch is not tracking the corresponding remote branch, fixing..."
git branch --set-upstream-to $branch $remote/$branch
fi
# else
Expand All @@ -69,12 +69,12 @@ if [ -n "$local_branch_exists" ] && [ ! "$local_branch_exists" == '' ]; then

# If remote exists, create a local branch that tracks the remote
elif [ -n "$remote_branch_exists" ] && [ ! "$remote_branch_exists" == '' ]; then
echo "Tracking existing remote branch '$remote_branch_exists'..."
echo "📡 Tracking existing remote branch '$remote_branch_exists'..."
git checkout -b $branch --track $remote/$branch

# Otherwise create a new local branch
else
echo "Creating new local branch..."
echo "✏️ Creating new local branch..."
git checkout -b $branch --no-track
fi

Expand Down
9 changes: 5 additions & 4 deletions merge
Expand Up @@ -20,16 +20,17 @@ fi
tracking=$(git branch -vv | egrep "^\*" | awk '{ print $4 '})
echo "tracking=$tracking"
if [[ ! "$tracking" =~ "$remote" ]]; then
echo "* Local-only branch, rebasing $branch onto $current_branch first..."
echo " Local-only branch, rebasing $branch onto $current_branch first..."
git checkout $branch
git rebase $current_branch || exit 1
else
echo "* This branch exists remotely, not rebasing"
echo "📡 This branch exists remotely, not rebasing"
fi

echo "* Merge $branch into $current_branch"
echo "✂️ Merge $branch into $current_branch"
git checkout $current_branch
git merge $branch || exit 1

echo "* Done"
echo
echo "🦄 Done"
exit 0
24 changes: 14 additions & 10 deletions pull
Expand Up @@ -12,10 +12,9 @@ color_reset="$(tput sgr0)"

# Pop any stashed changes
unstash() {
if [[ "$stash" =~ "No local changes to save" ]]; then
echo "* No stashed changes, not popping"
else
echo "* Popping stash..."
if [[ ! "$stash" =~ "No local changes to save" ]]; then
echo
echo "🕵 Popping stash..."
git stash pop
fi
}
Expand All @@ -37,7 +36,7 @@ remote_branch=$( (git config "branch.${branch}.merge" || echo "refs/heads/$branc
stash=$(git stash)

# Update our remote
echo "Fetching from $remote..."
echo "🚀 Fetching from $remote..."
git fetch $remote || rollback $?

# Pull, using rebase if configured
Expand All @@ -55,34 +54,39 @@ git remote prune $remote >/dev/null 2>&1 &
# Bundle em if you got em!
if [ "$GIT_FRIENDLY_NO_BUNDLE" != "true" ]; then
if which bundle >/dev/null 2>&1 && [ -f Gemfile ]; then
echo "* Bundling gems..."
echo
echo "⚔ Bundling gems..."
bundle check >/dev/null 2>&1 || bundle install
fi
fi

# Install Node.js packages with Yarn
if [ "$GIT_FRIENDLY_NO_YARN" != "true" ]; then
if which npm >/dev/null 2>&1 && [ -f yarn.lock ]; then
echo "* Installing npm packages..."
echo
echo "⚔ Installing npm packages..."
yarn install
fi
fi

# Install Node.js packages with npm
if [ "$GIT_FRIENDLY_NO_NPM" != "true" ]; then
if which npm >/dev/null 2>&1 && ( [ ! -f yarn.lock ] || [ "$GIT_FRIENDLY_NO_YARN" == "true" ] ) && [ -f package.json ]; then
echo "* Installing npm packages..."
echo
echo "⚔ Installing npm packages..."
npm install
fi
fi

# Install Bower components
if [ "$GIT_FRIENDLY_NO_BOWER" != "true" ]; then
if which npm >/dev/null 2>&1 && [ -f bower.json ]; then
echo "* Installing Bower components..."
echo
echo "⚔ Installing Bower components..."
bower install
fi
fi

echo "Done"
echo
echo "🦄 Done"
exit 0
14 changes: 7 additions & 7 deletions push
Expand Up @@ -28,18 +28,19 @@ if [ $exit_code != 0 ]; then
echo -e "${color_error}Ouch, push failed!${color_reset} code=$exit_code, output=$push"
exit $exit_code
elif echo $push | grep "Everything up-to-date" >/dev/null; then
echo "git says everything is up-to-date!"
echo "✌️ Git says everything is up-to-date!"
exit 0
fi

# Parse relevant commit refs and let user know what we did
# 1st-time push to new branch gets special treatment
if echo $push | grep "\[new branch\]" >/dev/null; then
refs="master...$branch"
echo "Pushed new branch '$branch' remotely"
echo "🚀 Pushed a new branch '$branch' remotely"
else
refs=$(echo $push | awk '{ print $3}' | sed 's/\.\./\.\.\./')
echo $push
echo "🚀 Pushed:"
echo "$push"
fi

# Parse output into a sexy GitHub compare URL!
Expand All @@ -57,12 +58,11 @@ if [[ "$remote_url" =~ "github.com" ]]; then
repo_name=$(echo $remote_url | sed $regEx)
github_url="$url$repo_name/compare/$refs"

copied="Compare URL copied to clipboard!"
which pbcopy >& /dev/null && echo $github_url | pbcopy && echo $copied
which xclip >& /dev/null && echo $github_url | xclip -selection clipboard && echo $copied
copied="\nCompare URL copied to clipboard:"
which pbcopy >& /dev/null && echo $github_url | pbcopy && echo -e "$copied"
which xclip >& /dev/null && echo $github_url | xclip -selection clipboard && echo -e "$copied"

echo $github_url
echo
fi

exit 0