Skip to content

Instantly share code, notes, and snippets.

@shamrin
Last active Dec 9, 2016
Embed
What would you like to do?
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