Skip to content

Instantly share code, notes, and snippets.

@nickboldt
Created November 9, 2012 19:13
Show Gist options
  • Save nickboldt/4047616 to your computer and use it in GitHub Desktop.
Save nickboldt/4047616 to your computer and use it in GitHub Desktop.
git workflow - applying a PR
First, add this to your .gitconfig file:
[alias]
lg = log --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %C(blue)%aE%Creset %Cgreen(%cr)%Creset' --abbrev-commit --date=relative
Next, ensure you have the correct remotes configured for your local repo, eg. one for every user from which you'll pull a PR, and an origin:
$➔ git remote -v
mistria git://github.com/mickaelistria/jbosstools-build.git (fetch)
mistria git://github.com/mickaelistria/jbosstools-build.git (push)
nickboldt git@github.com:nickboldt/jbosstools-build.git (fetch)
nickboldt git@github.com:nickboldt/jbosstools-build.git (push)
origin git@github.com:jbosstools/jbosstools-build.git (fetch)
origin git@github.com:jbosstools/jbosstools-build.git (push)
(Add more remotes with `git remote add <name> <URL>`)
--------------------
# apply a PR
TOPIC=JBIDE-12800-Beta2x
BRANCH=jbosstools-4.0.0.Beta2x
TOPIC=JBIDE-12800-master
BRANCH=master
echo $BRANCH, $TOPIC
git checkout -b ${BRANCH}; git checkout ${BRANCH}; git branch -v
git pull --rebase origin ${BRANCH}
git checkout -b ${TOPIC}; git checkout ${TOPIC}; git branch -v
git rebase ${BRANCH}
git checkout ${BRANCH}
git rebase ${TOPIC}
git branch -v
git lg -10
# * if all is well, then push the change *
git push origin ${BRANCH}
# purge old topic branch
git checkout master
git branch -D ${TOPIC}
TOPIC=
@nickboldt
Copy link
Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment