Skip to content

Instantly share code, notes, and snippets.

@CognitiveDisson
Last active April 1, 2022 09:50
Show Gist options
  • Save CognitiveDisson/53ed54ffda6cfc7960c43f7f2941a159 to your computer and use it in GitHub Desktop.
Save CognitiveDisson/53ed54ffda6cfc7960c43f7f2941a159 to your computer and use it in GitHub Desktop.
Git config
[alias]
fr = "!f() { echo Fetch ${1:-$3} and rebase to ${1:-$3}/${2:-master} && git fetch ${1:-$3} && git rebase ${1:-$3}/${2:-master}; }; if git ls-remote --exit-code upstream > /dev/null; then f $1 $2 'upstream'; else f $1 $2 'origin'; fi"
@CognitiveDisson
Copy link
Author

Example:

git fr
git fr <remote>
git fr <remote> <branch>

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