Add these to your ~/.gitconfig
under the [alias]
block:
[alias]
# list commands
le = log --oneline --decorate
ll = log --pretty=format:"%C(yellow)%h%Cred%d\\ %Creset%s%Cblue\\ [%cn]" --decorate --stat
ls = log --pretty=format:"%C(yellow)%h%Cred%d\\ %Creset%s%Cblue\\ [%cn]" --decorate
lds = log --pretty=format:"%C(yellow)%h\\ %ad%Cred%d\\ %Creset%s%Cblue\\ [%cn]" --decorate --date=short
ld = log --pretty=format:"%C(yellow)%h\\ %ad%Cred%d\\ %Creset%s%Cblue\\ [%cn]" --decorate --date=relative
lnc = log --pretty=format:"%h\\ %s\\ [%cn]"
lg = log --graph --oneline --decorate --all
sync = pull --rebase upstream master
f = checkout -b
pf = push -u origin
kf = !sh -c 'git branch -D $1 && git push origin --delete $1' -
feature = checkout -b
pushFeature = push -u origin
killFeature = !sh -c 'git branch -D $1 && git push origin --delete $1' -
Install the Hub CLI
$ brew install hub
Add this to your `~/.gitconfig
[hub]
host = git.target.com
[github]
host = git.target.com
user = [your_git_name]
Add this to your shell aliases:
alias pr='hub pull-request -o'
alias pfpr="git pf && pr"
function take() {
mkdir -p "$1"
cd "$1"
}
function copr() {
echo "Checking out PR $1 to local branch"
git fetch upstream pull/$1/head:pr-$1
git co pr-$1
}
- Fork the repo into personal git
- Clone the repo from personal git
- Set
upstream
remote repo to master repo.git remote add upstream git@git.target.com:[org]/[repo].git
- Create a local feature branch.
git f my_cool_feature_branch_name
- HACK AWAY
- commit code to feature brach
- Sync any upstream changes and resolve conflict if needed:
git sync
- Cut a PR with
pfpr
. This will push the feature branch to your forked repo (the pf) then create a PR and open it up in your default browser. - Merge the PR (after a thurough approval process)
- Check out master branch locally:
git co master
- Sync all changes to master:
git sync
- Clean up local and remote branchs:
git kf my_cool_feature_branch_name
orgit killFeature my_cool_feature_branch_name
- PROFIT!