Last active
March 8, 2019 11:32
-
-
Save star-szr/816073161aa7335af1cd to your computer and use it in GitHub Desktop.
Quick branch creation and patch applying
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
# Create or go to branch. | |
git go <name of branch> | |
# Apply the patch, commit with a commit message of "p". | |
cape && gcm p |
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
[alias] | |
# Switch to a branch, creating it if necessary | |
go = "!f() { git checkout -b \"$1\" 2> /dev/null || git checkout \"$1\"; }; f" |
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
alias gcm="git commit -m" |
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
# Patch shortcuts | |
# | |
# Copy a patch URL to the clipboard, then run one of these commands to download | |
# the patch and apply it. Hat tip to @chrisjlee for making me reconsider curl. | |
# | |
# Apply | |
alias cap='curl `pbpaste` | git apply -v' | |
# Apply and stage | |
alias cape='curl `pbpaste` | git apply -v --index' | |
# Apply with `patch` | |
alias capp='curl `pbpaste` | patch -p1' | |
# Reverse apply | |
alias carp='curl `pbpaste` | git apply -Rv' | |
# Reverse apply and stage | |
alias carpe='curl `pbpaste` | git apply -Rv --index' | |
# Verify patch | |
alias cav='curl `pbpaste` | git apply -v --check' | |
# Verify patch with `patch` | |
alias capv='curl `pbpaste` | patch -p1 --dry-run' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment