Skip to content

Instantly share code, notes, and snippets.

@tamer1an
Last active May 16, 2020 19:45
Show Gist options
  • Save tamer1an/806b0e6c605cea40d262044c0ef6957e to your computer and use it in GitHub Desktop.
Save tamer1an/806b0e6c605cea40d262044c0ef6957e to your computer and use it in GitHub Desktop.
git
# This is Git's per-user configuration file.
[user]
# Please adapt and uncomment the following lines:
name = Andrii
email = [email protected]
[alias]
alias = config --get-regexp ^alias\\. #display all aliases
cm = commit -m #{@message} commit with message
cma = commit -am #{@message} commit with message and adding files
nbr = checkout -b #{@branchName} create new branch
brm = checkout master #short way to checkout branch master
brd = checkout develop #short way to checkout branch develop
pm = pull origin master #short way to pull branch master
pd = pull origin develop #short way to pull branch develop
fpm = !sh -c 'git brm && git fetch && git pm' #short way to checkout fetch and pull branch master
fpd = !sh -c 'git brd && git fetch && git pd' #short way to checkout fetch and pull branch develop
task = "!f() { newName=${1-NEWTASK}; git fpd && git nbr JIRAID-$newName; }; f" #{@ID} short way to checkout, fetch, pull from develop branch and create new branch with JIRA board id !!! REPLACE NEOC$
release = "!f() { newName=${1-NEWRELEASE}; git fpd && git nbr release/v$newName; }; f" #{@version} short way to checkout, fetch, pull from develop branch and create new release branch
unstage = reset HEAD #reset from adding files to commit
undo = reset --hard #full reset and revert changes
re = checkout . #reset modified files that was in repo before chages
st = status --short --branch #short status info
so = show --pretty='parent %Cred%p%Creset commit %Cred%h%Creset%C(yellow)%d%Creset%n%n%w(72,2,2)%s%n%n%w(72,0,0)%C(cyan)%an%Creset %Cgreen%ar%Creset' #changes in last commit
plog = log --pretty='%Cred%h%Creset | %C(yellow)%d%Creset %s %Cgreen(%cr)%Creset %C(cyan)[%an]%Creset' --graph #pretty history log
diffstat = diff --stat -r #short difference statistic
new = !sh -c 'git log $1@{1}..$1@{0} "$@"' #show new commits
whatis = show -s --pretty='tformat:%h (%s, %ad)' --date=short #what was the last changes
whois = "!sh -c 'git log -i -1 --pretty=\"format:%an <%ae>\n\" --author=\"$1\"' -" #who made last commit
######## new shortcuts
info = branch -vv
# switch to prev branch git checkout @{-1}
brp = checkout -
# add branch name
listAllMergedBranches = branch --merged
# remove branches that was merged
# rbrm = "!sh -c 'git branch --merged master | grep -v '^\*' | xargs -n 1 git branch -d' -"
# rbrd = !sh -c 'git branch --merged develop | grep -v '^\*' | xargs -n 1 git branch -d'
# add code in quotes ''
fcode = log -S
# add filename
ffile = log -p
# add commit hash
allFilesTillCommit = ls-tree --name-only -r
resetKeep = reset --keep
listChangedFiles = diff-tree --no-commit-id --name-only -r
reword = commit -v --amend
# http://pl.blitzortung.org/live_lightning_maps.php?map=15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment