Created
January 8, 2016 21:46
-
-
Save morganestes/ccec34bd27dd07b61235 to your computer and use it in GitHub Desktop.
Custom Git commands for my workflow
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
| This is a collection of Git commands I use on a regular basis. |
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
| #!/usr/bin/sh | |
| # | |
| # "Archive" the current branch | |
| # | |
| # Once a feature branch has been code reviewed, approved, and merged, | |
| # tag it in it's current state and save it for later. | |
| # | |
| readonly local_branch=$(git whereami) | |
| readonly archive_branch="archive/${local_branch}" | |
| upstream="origin" || "$1" | |
| main() { | |
| archive_tag | |
| remove_archived_branch | |
| } | |
| archive_tag() { | |
| git tag "${archive_branch}" | |
| git push "${upstream}" "${archive_branch}" | |
| } | |
| remove_archived_branch() { | |
| git checkout master | |
| #local | |
| git branch -d "${local_branch}" | |
| #upstream | |
| git push origin --delete "${local_branch}" | |
| } | |
| main "$1" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment