Last active
February 17, 2016 17:50
-
-
Save bakerface/23c686ea3fe09ed7de59 to your computer and use it in GitHub Desktop.
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
# git feature foo-bar (creates a branch called feature-foo-bar) | |
# ... | |
# git publish | |
git config --global alias.feature "!f() { git checkout -b feature-\$1 develop; }; f" | |
git config --global alias.publish-feature "!f() { LOCAL=\$(git rev-parse --abbrev-ref HEAD); FEATURE=\$(echo \$LOCAL | sed -E 's/^.{8}//'); git checkout develop && git merge \$LOCAL && git branch -d \$LOCAL && git push origin develop; }; f" | |
# git release 1.0.0 (creates a branch called release-v1.0.0) | |
# ... | |
# git publish | |
git config --global alias.release "!f() { git checkout -b release-v\$1 develop && ./bump-version \$1 && git commit -a -m \"Updated version to \\\`\$1\\\`.\"; }; f" | |
git config --global alias.publish-release "!f() { LOCAL=\$(git rev-parse --abbrev-ref HEAD); VERSION=\$(echo \$LOCAL | sed -E 's/^.{9}//'); git checkout master && git merge \$LOCAL && git push origin master && git tag -a -m \"Created tag for version \\\`\$VERSION\\\`.\" v\$VERSION && git push origin v\$VERSION && git checkout develop && git merge master && git branch -d \$LOCAL && git push origin develop; }; f" | |
# git hotfix 1.0.1 (creates a branch called hotfix-v1.0.1) | |
# ... | |
# git publish | |
git config --global alias.hotfix "!f() { git checkout -b hotfix-v\$1 master && ./bump-version \$1 && git commit -a -m \"Updated version to \\\`\$1\\\`.\"; }; f" | |
git config --global alias.publish-hotfix "!f() { LOCAL=\$(git rev-parse --abbrev-ref HEAD); VERSION=\$(echo \$LOCAL | sed -E 's/^.{8}//'); git checkout master && git merge \$LOCAL && git push origin master && git tag -a -m \"Created tag for version \\\`\$VERSION\\\`.\" v\$VERSION && git push origin v\$VERSION && git checkout develop && git merge master && git branch -d \$LOCAL && git push origin develop; }; f" | |
# git publish is a facade for the specific type of publishes | |
git config --global alias.publish "!f() { LOCAL=\$(git rev-parse --abbrev-ref HEAD); TYPE=\$(echo \$LOCAL | cut -c 1-3); if [ \"\$TYPE\" = \"fea\" ]; then git publish-feature; elif [ \"\$TYPE\" = \"rel\" ]; then git publish-release; elif [ \"\$TYPE\" = \"hot\" ]; then git publish-hotfix; else echo \"Cannot publish from branch \$LOCAL\"; echo \"Please publish from a feature branch, release branch, or hotfix branch.\"; fi; }; f" | |
# git graph (shows a commit graph in terminal) | |
git config --global alias.graph "log --graph --abbrev-commit --decorate --format=format:'%C(bold blue)%h%C(reset) - %C(bold cyan)%aD%C(reset) %C(bold green)(%ar)%C(reset)%C(bold yellow)%d%C(reset)%n'' %C(white)%s%C(reset) %C(dim white)- %an%C(reset)' --all" | |
# have git cache your password for an hour | |
git config --global credential.helper 'cache --timeout=3600' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment