Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Git workflow: forking a project and maintaing a local modified copy, but keep up to date

I'm trying to figure out the best workflow for maintaining a local copy of a github-hosted project (moodle) with customizations, while maintaining the ability to keep our copy up-to-date. Tell me if what I'm thinking about doing is completely insane:

  1. Fork the project (github.com/moodle/moodle --> github.com/sfu/moodle)
  2. Create an upstream remote (git remote add upstream git://github.com/moodle/moodle.git && git fetch upstream)
  3. Create a branch for our custom development and keep master pristine.
  4. When we want to update our fork, update the pristine branch (git checkout master && git fetch upstream && git merge upstream/master)
  5. Merge master into our customizations branch (git checkout custom && git merge master)

Does this make sense?

like image 698
grahamb Avatar asked Feb 21 '12 22:02

grahamb


1 Answers

Yes, it makes sense. Although step #4 can be slightly simplified to git checkout master && git pull --ff-only upstream master.

The --ff-only ensures that you don't get any merge commits in your pristine copy.

like image 62
leedm777 Avatar answered Nov 15 '22 23:11

leedm777