Last active
December 23, 2015 09:09
-
-
Save star-szr/6612251 to your computer and use it in GitHub Desktop.
Bash aliases for testing and applying patches based on the URL on your clipboard. If you're on OS X, grab the first three lines and add to your ~/.bash_profile. If you're on Linux, grab lines 5-8 and add to your ~/.bash_profile or ~/.bashrc or whatnot :)Testbot uses git to apply patches, I only include the `patch` version here because sometimes …
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
# These ones are for OS X. | |
alias cav='curl `pbpaste` | git apply -v --check' | |
alias capv='curl `pbpaste` | patch -p1 --dry-run' | |
# These are untested but should work on many flavours of Linux. If they don't, | |
# please leave a comment! | |
alias cav='curl `xsel --clipboard --output` | git apply -v --check' | |
alias capv='curl `xsel --clipboard --output` | patch -p1 --dry-run' | |
# Patch shortcuts (some duplication of the above, but covers more use cases). | |
# | |
# Replace `pbpaste` with `xsel --clipboard --output` for Linux! | |
# | |
# 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
The Linux commands work on Ubuntu.