Git fetch-rebase
Jump to navigation
Jump to search
I realized I'd been doing a set of manual commands when a coworker called it out.
From a feature branch, I'd switch back to the main branch, pull, then switch back to the feature branch and rebase the main branch.
git switch main git pull git switch - git rebase main
However this can be done without switching branches:
git fetch origin git rebase origin/main
and I put it in my gitconfig as a single command:
[alias] fetch-rebase = "!git fetch origin && git rebase origin/$(git base)"
and gave it a fish abbr:
abbr -a fr git fetch-rebase
Now I can run
puppet $ git fetch-rebase Successfully rebased and updated refs/heads/T301565-karapace.