Last active
November 2, 2017 09:54
-
-
Save krzysu/fee862390f18a71a1c73ecc2d6c1eed1 to your computer and use it in GitHub Desktop.
git advanced commands
This file contains hidden or 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
# for local branches | |
git branch -avv | grep "release-2014" | awk '{ print $1 }' | xargs -n 1 git branch -D | |
# by branch name pattern | |
git branch -avv | grep "release-2014" | awk '{ gsub(/remotes\/origin\//, ""); print $1 }' | xargs -n 1 git push origin --delete | |
# merged to master | |
git branch -a --merged | egrep -v "(^\*|master|dev)" | awk '{ gsub(/remotes\/origin\//, ""); print $1 }' | xargs -n 1 git push origin --delete | |
# by commit date | |
git branch -a --sort=committerdate | head -n 20 | awk '{ gsub(/remotes\/origin\//, ""); print $1 }' | |
# commits in certain dates by certain people | |
git log --after="2017-10-25 00:00" --before="2017-10-27 00:00" --pretty=format:'%h%x09%an%x09%ad%x09%s' | grep -e 'Kris' -e 'Olexiy' -e 'Akbar' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment