Last active
August 29, 2015 14:03
-
-
Save vegaasen/75759d3403b4c068692b to your computer and use it in GitHub Desktop.
Simple GIT Commands/Shortcuts
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
| #!/bin/sh | |
| ## | |
| ## Simple GIT Commands | |
| ## | |
| # Branch Overview | |
| echo "Adding branch overview. Use git bo to see it in action"; | |
| git config --global alias.boja 'log --all --graph --decorate=short --pretty=format:"%C(yellow bold)%h%C(white)% an%C(auto): (%ar)%+d"'; | |
| git config --global alias.bojaa 'log --pretty --format="%C(green)%ce @ -- %C(yellow)%ar -- %C(white)%h %C(blue)%s" --graph --all'; | |
| # Convenience | |
| echo "Adding convenience aliases"; | |
| git config --global alias.ci 'commit -v'; | |
| git config --global alias.st 'status'; | |
| git config --global alias.ba 'branch -a'; | |
| git config --global alias.ca 'config --global --list'; | |
| git config --global alias.mybranch 'branch --contains'; | |
| ## | |
| ## Git scripts | |
| ## | |
| # Transfer git repo from one to another | |
| git filter-branch --prune-empty --tree-filter ' | |
| if [[ ! -e foo/bar ]]; then | |
| mkdir -p foo/bar; | |
| git ls-tree --name-only $GIT_COMMIT | xargs -I files mv files foo/bar; | |
| fi'; | |
| ## | |
| ## GIT flowness | |
| ## | |
| brew install git-flow | |
| # crate base structure for the repository (feature, hotfix etc) - press (enter) through them all :-) | |
| git flow init | |
| ## | |
| ## GIT Commands | |
| ## | |
| # Edit commit | |
| git reset --soft HEAD^ | |
| edit | |
| git commit -am "some-new-message-here" |
Author
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This is just ment to be a reminder for myself. If someone else also likes this stuff, then cool! If not - thats cool too :-P