(当初、この回答は、サードパーティのコンポーネントがパブリック git リポジトリからのものであると想定していました。@ jacob-dorman は、より大きなプロジェクトのスナップショットからコンポーネントのコードをコピーすることで更新を取得することを明らかにしました)
2 つのブランチを持つリポジトリを維持する必要があります。
master
: コンポーネントの新しいスナップショットを取得するたびに、このブランチにコミットします
tweaks
master
:カスタム調整を構成するコミットを含む、ブランチに基づくブランチ
コンポーネントの新しいスナップショットで「マスター」ブランチを更新するたびに、tweaks
ブランチをブランチの上にリベースしますmaster
。
$ git rebase master tweaks
これにより、微調整が事実上最後に発生したものとして残ります。
したがって、最初から、これはコマンドラインでどのように見えるかです...
最初のスナップショットを取得し、「マスター」ブランチに保存します
mkdir my-fork-of-shinything
cd my-fork-of-shinything
git init
cp -R /tmp/shinything-snapshot-1 . # copy the snapshot of code into your repo
git add -A // stages ALL directory contents for commit
git commit -m "V1 snapshot of the shinything component"
これで「マスター」ブランチが設定されます。
新しい「tweaks」ブランチに微調整を追加します
git checkout -b tweaks // creates your new branch
... make your tweaks, commit them
後で、元のコンポーネントにいくつかの興味深い更新が行われたときに...
新しいコンポーネントのスナップショットを取得し、'master' および 'tweaks' ブランチを更新します
git checkout master
rm -Rf * // delete the contents of the old snapshot
cp -R /tmp/shinything-snapshot-2 . // get the brand new snapshot in place
git add -A
git commit -m "V2 snapshot of shinything, brings fix for #234"
マスター ブランチには、コンポーネントの更新された履歴があり、スナップショットの更新ごとにコミットされます。最後に、'tweaks' ブランチをマスター ブランチにリベースします。'tweaks' ブランチの各コミットは、マスター ブランチの新しい先端の上で次々と再生されます。
git rebase master tweaks // re-bases the commits from your tweaks branch
さらに微調整?
さらに微調整を追加する必要がある場合は、ブランチをチェックアウトして追加してください。
git checkout tweaks
... make your tweaks, commit them