Skip to content

Instantly share code, notes, and snippets.

@shamrin
Last active December 9, 2016 09:30
Show Gist options
  • Save shamrin/afd859cfb6cc786aa7e3 to your computer and use it in GitHub Desktop.
Save shamrin/afd859cfb6cc786aa7e3 to your computer and use it in GitHub Desktop.
ffmerge and ffrebase: merge in fast-forward-only single-commit workflow
#!/usr/bin/env fish
set branch (git symbolic-ref -q --short HEAD)
or exit 1
if test $branch = "master"
echo "error: can't ffmerge master to master, switch to feature branch first"
exit 2
end
set commands \
"git checkout master" \
"git merge --ff-only origin/master" \
"git merge --ff-only $branch" \
"git push origin master:master"
for command in $commands
echo "# $command"
eval $command
or exit 3
end
#!/usr/bin/env fish
set branch (git symbolic-ref -q --short HEAD)
or exit 1
if test $branch = "master"
echo "error: can't ffrebase master to master, switch to feature branch first"
exit 2
end
set commands \
"git fetch" \
"git rebase origin/$branch" \
"git rebase -i origin/master" \
"git push origin +$branch:$branch"
for command in $commands
echo "# $command"
eval $command
or exit 3
end
echo "Done. Review changes and run ffmerge"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment