Skip to content

Instantly share code, notes, and snippets.

@chrisk
Created October 24, 2008 18:31
Show Gist options
  • Save chrisk/19541 to your computer and use it in GitHub Desktop.
Save chrisk/19541 to your computer and use it in GitHub Desktop.
#!/bin/bash
#
# Pushes the earliest commit from the current branch (using git-svn dcommit),
# keeping your other unpushed commits intact and updating the pushed commit
# with git-svn metadata.
#
# Usage:
# git pushone
#
rev=$(git rev-list --reverse HEAD...trunk | head -n1)
# turn off the pager
git config pager.log false
echo -e "\033[1mCommit to push:\033[0m"
git log --pretty=tformat:"%Cred%h%Creset %s" $rev^..$rev
read -n1
echo -e "\033[1mgit svn dcommit $rev --no-rebase\033[0m"
git svn dcommit $rev --no-rebase
echo -e "\033[1mgit svn rebase\033[0m"
git svn rebase
# reset pager to default
git config --unset pager.log
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment