-
Notifications
You must be signed in to change notification settings - Fork 35
Git Admin Tutorial
Admins have a few additional tasks they may wish to perform with git.
#Accept Pull Request to Feature Branch If no changes need to be made to the pull request, you can just click "accept pull request"; there's no need to use git. Please ensure that they have submitted the pull request to the correct feature branch.
#Accept a Pull Request for a New Feature
For a new feature, the process is a bit more complicated. First, ensure they have submitted the pull request to the master
branch (if not, have them re-submit or ask someone familiar with git (e.g. LamilLerran) to help). Then, on your local git repository, check out the master branch and ensure it is up to date:
git checkout master
git pull upstream master
(You will need -- or at least want -- to have no uncommitted changes before doing this.)
Make sure there is another branch at the same location and take note of the branch name (right now, I'm expecting this will generally be release-[latest]
but our branching setup is new. At the moment beta
is at the same place as master
but that will change.) You can check if a commit is at the same location by typing git branch -v
and ensuring that branch has the same commit number (the 7 numbers/letters at the beginning) as master
. If there is no such branch, create one. I will call this branch previous
Once you've confirmed all this, accept the pull request on github. Then pull the updated master branch to your local copy with
git pull upstream master
Create a branch name for the new feature, say new-feature-name
with
git checkout -b new-feature-name
Now without changing branches send the master
branch back to where it was with
git branch --force master previous
where previous
is the name of the branch that was at the same location as master. If this was a branch you created just for the purpose of keeping track of master, you can now delete it with
git branch -d previous
where again previous
is the name of the branch to delete.
Now upload your changes to git. You should still be on the new-feature-name
branch, so push it with
git push upstream new-feature-name
Change to master
and push it with
git checkout master
git push --force upstream master
Note that this is a bit of a hack; you're not supposed to use --force
with remote branches. That said, github doesn't allow people to submit pull requests to a new branch, and with a different branch at the same place you were push --force
ing master away from I'm pretty sure the worst will happen is someone might branch from the new feature rather than master. Which is annoying, but shouldn't create mystery merge issues or other history conflicts.