-
Notifications
You must be signed in to change notification settings - Fork 0
Git Workflow
This document outlines how we use git on the Hydra project, but we’ve been eyeing up the git-flow tools. We wonder which option presents less of an obstacle for new contributors. If you have an opinion, speak up on the hydra-tech list.
Good places to read about git workflows:
You might want to set up your shell prompt to tell you which git branch you’re in.
Scenario: You’re working on the HYDRA-333 ticket.
- You already have a working copy of hydra-head cloned to your local machine.
- Your work is starting from the contents of hydra-head/master
The steps:
- Create a feature branch
- If necessary, push a copy of the working branch to github
- Rebase the feature branch
- Merge the finished work into Master
- Clean up after yourself
Here’s how to do the right thing with git on the command line. Note: the parts in parentheses indicates which branch you should be on when you run the command. If it doesn’t matter which branch you’re on, this is indicated with (*).
cd hydra-head (master) git checkout -b HYDRA-333
Make changes and commit them to your feature branch like normal.
(HYDRA-333) git add … (HYDRA-333) git commit …
If you need to share your feature branch, push it to github
(HYDRA-333) git push origin HYDRA-333
Repeat work until the HYDRA-333 ticket is ready to close, then rebase that work & merge it into the master branch …
(*) git checkout master (master) git pull origin master (master) git checkout HYDRA-333 (HYDRA-333) git rebase master ... walk through the rebase ...
At this point, you should rerun your full test suite to make sure that the rebase did not break anything.
If all of the tests pass after the rebase, you’re ready to merge your work into master and push it to github.
(HYDRA-333) git checkout master (master) git merge HYDRA-333 (master) git push origin master
Now delete the local & remote copies of the feature branch
(master) git branch -d HYDRA-333 (master) git push origin :HYDRA-333
We don’t recommend this for new users or for production applications, but it is very useful during active development.
If you are in a position where you want/need to run your application with the very latest hydra-head code from Github, this is easy to do. Simply update the line in your Gemfile that lists hydra-head as a dependency and enter this instead:
gem "hydra-head", :git => "git://github.com/projecthydra/hydra-head.git"
After updating the Gemfile, re-run ‘bundle install’.
You can also do this with other gems. For example, if you want to force your app to use the latest active-fedora code from the “HYDRA-721” branch on GitHub, you can put this in your Gemfile:
gem "active-fedora", :git=>'git://github.com/mediashelf/active_fedora.git'