GithubHelp home page GithubHelp logo

my-dev-env's Introduction

My Development Environment

Little things that make me go faster

CLI

Vim

~/.bash_profile

  • Add a folder for adding scripts
# Add your bin folder to the path, if you have it.  It's a good place to add all your scripts
if [[ -d "$HOME/bin" ]]; then
  export PATH="$HOME/bin:$PATH"
fi

~/.bashrc

alias gb='git branch -v'
alias gcb='git checkout -b'
alias gd='git diff'
alias gl="git log --date=local"
alias gs='git status'
alias gss='git status --short --branch'

function gco {
  if [[ $# == 0 ]]; then
    git checkout master
  else
    git checkout "$@"
  fi
}

~/bin

  • Git Open PR
#!/usr/bin/env bash
# Open the PR for the given commit

if [ $# == 0 ]; then
  # No args, use the current HEAD
  merge=$(git-find-merge)
elif [ $# == 1 ]; then
  # Passed a commit, try to find its merge
  merge=$(git-find-merge ${1})
  if [ "${merge}" == "" ]; then
    # Failing that, maybe the commit was a merge
    merge=${1}
  fi
else
  echo "Open the PR for the given commit"
  echo ""
  echo "Usage: $(basename "${0}") <sha>"
  echo "  sha: If empty, use the HEAD commit"
  echo ""
  echo "NOTE: The PR must have already been merged"
  exit 1
fi

repo_url=$(git config remote.origin.url | sed -e 's/^git@\(.*\):\(.*\)$/git:\/\/\1\/\2/' | sed 's/^.*\/\/\(.*\).git$/\1/' | sed -e 's/\git@//')
project=$(echo $repo_url | awk 'BEGIN { FS="/" } ; { print $2 }')
repo=$(echo $repo_url | awk 'BEGIN { FS="/" } ; { print $3 }')
pr=$(git log -n1 ${merge} | grep "Merge pull request #" | head -n 1 | sed  's%^.*Merge pull request #\([[:digit:]]*\).*%\1%')

if [ "$pr" == "" ]; then
  echo "Could not find PR # for ${merge}"
  exit 1
fi

url="https://blah/$project/repos/$repo/pull-requests/$pr/overview"
echo $url
open $url
exit 0

my-dev-env's People

Contributors

oliw avatar oliverwilkie avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.