简体   繁体   中英

Maintaining a fork with patches in master

I want to maintain a fork with custom functionality added on top of the original code. It is not a contribution to the project itself and won't be merged upstream.

What I want to achieve:

  • The GitHub page of the fork should point to the patched version of the project instead of the original one.
  • I should be able to easily merge new upstream code while preserving a separate history for my own commits.

My current plan is to have the upstream/master branch in the fork repository as vendor , from which my own master will be branched. Whenever there is a stable release upstream I can pull & push it into the vendor branch and than rebase my master .

Questions:

  1. Is there an easier or cleaner way to achieve the same results?
  2. Should I fork via GitHub web-interface and then move master , or should I create the repository locally as described in this answer ?

A fork is just a more formal way to link those two GitHub repo.

You don't even need to name upstream/master as "vendor": you can directly rebase your own master branch on top of that remote branch.

git fetch upstream
git checkout master
git rebase upstream/master

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM