Skip to content

Instantly share code, notes, and snippets.

@localshred
Created February 16, 2012 21:02
Show Gist options
  • Save localshred/1847820 to your computer and use it in GitHub Desktop.
Save localshred/1847820 to your computer and use it in GitHub Desktop.
git helpers for mainline branch synchronization and checking
# Synchronize all mainline branches (master, qa, stage, stable)
function reposync() {
git fetch
git checkout master
git rebase origin/master
git checkout qa
git rebase origin/qa
git checkout stage
git rebase origin/stage
git checkout stable
git rebase origin/stable
git checkout master
}
# Upstream out-of-date branch check (e.g. what does master have that qa doesn't)
function upcherry() {
echo 'Upstream out-of-date branch check'
echo '[master > qa]'
git ch qa master
echo '[qa > stage]'
git ch stage qa
echo '[stage > stable]'
git ch stable stage
}
# Downstream out-of-date branch check (e.g. what does stable have that master doesn't)
function dncherry() {
echo 'Downstream out-of-date branch check'
echo '[qa > master]'
git ch master qa
echo '[stage > qa]'
git ch qa stage
echo '[stable > stage]'
git ch stage stable
echo '[stable > master]'
git ch master stable
}
# Run the upcherry command against all repos (does not assume up-to-date)
function srvupcherry() {
for repo in repo1 repo2 ... repoN;
do
echo $repo
cd /code/src/$repo
upcherry
echo '----'
done
}
# Run the dncherry command against all repos (does not assume up-to-date)
function srvdncherry() {
for repo in repo1 repo2 ... repoN;
do
echo $repo
cd /code/src/$repo
dncherry
echo '----'
done
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment