Skip to content

Instantly share code, notes, and snippets.

@larowlan
Last active June 13, 2021 22:39
Show Gist options
  • Select an option

  • Save larowlan/18624d5554c52e90c613 to your computer and use it in GitHub Desktop.

Select an option

Save larowlan/18624d5554c52e90c613 to your computer and use it in GitHub Desktop.
; generates interdiff into ~/patches from current diff
alias.interdiff=!git diff > ~/patches/interdiff.txt
; generates interdiff into ~/patches from current staged diff
alias.interdiff-stg=!git diff --staged > ~/patches/interdiff.txt
; generates patch into ~/patches based on branch name.
; usage git genpatch {comment number}
alias.genpatch=!sh -c "br=`git symbolic-ref HEAD|sed s#refs/heads/##`; git diff origin/8.0.x > ~/patches/\${br}.$1.patch"
; rebase branch of 8.0.x
alias.rebase8x=!git fetch origin && git rebase origin/8.0.x
; merge 8.0.x
alias.merge8x=!git fetch origin && git merge origin/8.0.x
; fetch and apply a patch
; usage git fetch-patch {url-to-patch-file}
alias.fetch-patch=!sh -c "curl $1 | git apply"
; creates a new branch, fetches and commits latest patch
; usage git issue {branch name} {url to patch file}
alias.issue=!sh -c "git co 8.0.x && git pull && git co -b $1 && git fetch-patch $2 && git add core && git ci 'latest-patch'"
; creates a new branch of 8.0.x head
; usage git newbr {branch name}
alias.newbr=!sh -c "git co 8.0.x && git pull && git co -b $1"
@jibran
Copy link
Copy Markdown

jibran commented May 25, 2016

Minor update suggestion.
alias.fetch-patch=!sh -c 'curl "$1" | git apply -v --index --reject' -
alias.issue=!sh -c "git co 8.0.x && git pull --rebase && git co -b $1 && git fetch-patch $2 && git ci 'latest-patch'"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment