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

假如想象 提交于 2019-12-20 10:34:35

问题


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?


回答1:


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.




回答2:


Makes sense

... and if you like, compare with bible :

a successful git branching model



来源:https://stackoverflow.com/questions/9386352/git-workflow-forking-a-project-and-maintaing-a-local-modified-copy-but-keep-up

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!