Last active
April 19, 2018 18:11
-
-
Save deeshank/279d1a77678282b2be18fd3bc4bd1bc7 to your computer and use it in GitHub Desktop.
GIT Aliases
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# This is Git's per-user configuration file. | |
[user] | |
name = Deepak | |
email = shanky.cs@gmail.com | |
[alias] | |
#show aliases | |
la = "!git config -l | grep alias | cut -c 7-" | |
co = checkout | |
br = branch | |
ci = commit | |
st = status | |
df = diff | |
ds = diff --staged | |
ls = ls-files | |
unstage = reset HEAD | |
l = log -10 | |
# git command to push your current branch by typing git push origin [current-branch-name] | |
pb = "!git push origin \"$(git rev-parse --abbrev-ref HEAD)\"" | |
# opens current branch on github | |
gh = "!open \"$(git remote -v | grep origin | grep push | cut -f 2 | cut -d \" \" -f 1 | sed -e \"s|git@\\(.*\\):\\(.*\\).git|https://\\1/\\2|\")/tree/$(git rev-parse --abbrev-ref HEAD)\"" | |
# this alias opens up GitHub to ‘/owner/repoName/pulls/new/current-branch-name‘ | |
# so that you can fill in a detailed pull request (you are filling out a pull | |
# request with a description and testing plan | |
pr = "!open \"$(git remote -v | grep origin | grep push | cut -f 2 | cut -d \" \" -f 1 | sed -e \"s|git@\\(.*\\):\\(.*\\).git|https://\\1/\\2|\")/pull/new/$(git rev-parse --abbrev-ref HEAD)\"" | |
# Show files ignored by git: | |
ign = ls-files -o -i --exclude-standard | |
lol = log --graph --decorate --pretty=oneline --abbrev-commit | |
lola = log --graph --decorate --pretty=oneline --abbrev-commit --all --date=local | |
lds = log --pretty=format:"%C(yellow)%h\\ %ad%Cred%d\\ %Creset%s%Cblue\\ [%cn]" --decorate --date=relative | |
lasttag = describe --tags --abbrev=0 | |
lt = describe --tags --abbrev=0 | |
# fetch & reset to remote/origin | |
resetorigin = !git fetch origin && git reset --hard origin/$(git rev-parse --abbrev-ref HEAD) | |
resetupstream = !git fetch upstream && git reset --hard upstream/$(git rev-parse --abbrev-ref HEAD) | |
#Finding files and content inside files | |
f = "!git ls-files | grep -i" | |
# fetch & rebase from remote/origin | |
remote-up = "!git fetch upstream && git pull --rebase upstream $(git rev-parse --abbrev-ref HEAD)" | |
origin-up = "!git fetch origin && git pull --rebase origin $(git rev-parse --abbrev-ref HEAD)" | |
[log] | |
date = relative | |
[format] | |
pretty = format:%h %Cblue%ad%Creset %ae %Cgreen%s%Creset | |
[color] | |
ui = true | |
[push] | |
default = current | |
[core] | |
excludesfile = /Users/deepak/.gitignore_global | |
[difftool "sourcetree"] | |
cmd = opendiff \"$LOCAL\" \"$REMOTE\" | |
path = | |
[mergetool "sourcetree"] | |
cmd = /Applications/Sourcetree.app/Contents/Resources/opendiff-w.sh \"$LOCAL\" \"$REMOTE\" -ancestor \"$BASE\" -merge \"$MERGED\" | |
trustExitCode = true |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment