-
Notifications
You must be signed in to change notification settings - Fork 119
/
merging_upstream.html.md.erb
56 lines (38 loc) · 2.16 KB
/
merging_upstream.html.md.erb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
---
title: Merging with upstream buildpacks
owner: Buildpacks
---
Learn how to maintain your forked buildpack by merging it with the upstream Cloud Foundry buildpack.
This process keeps your fork updated with changes from the original buildpack, providing patches, updates, and new features.
The following procedure assumes that you are maintaining a custom buildpack that was forked from
a Cloud Foundry system buildpack. However, you can use the same procedure to update a buildpack forked from any upstream buildpack.
To sync your forked buildpack with an upstream Cloud Foundry buildpack:
1. Go to your forked repository on GitHub and click **Compare**. The **Comparing changes** page shows the unmerged commits between your forked buildpack and the upstream buildpack. Inspect unmerged commits and confirm that you want to merge them all.
2. Go to the forked repository and set the upstream remote as the Cloud Foundry buildpack repository.
<pre class="terminal">
$ cd ~/workspace/ruby-buildpack
$ git remote add upstream git<span>@</span>github.com:cloudfoundry/ruby-buildpack.git
</pre>
3. Pull down the remote upstream changes.
<pre class="terminal">
$ git fetch upstream
</pre>
4. Merge the upstream changes into the intended branch. You might need to resolve merge conflicts.
This example shows the merging of the `main` branch of the upstream buildpack into the `main` branch of the forked buildpack.
<pre class="terminal">
$ git checkout main
$ git merge upstream/main
</pre>
<p class="note important">
When you merge upstream buildpacks, do not use <code>git rebase</code>.
This approach is not sustainable because you confront the same merge conflicts repeatedly.</p>
5. Run the buildpack test suite to ensure that the upstream changes do not break anything.
<pre class="terminal">
$ BUNDLE_GEMFILE=cf.Gemfile buildpack-build
</pre>
6. Push the updated branch.
<pre class="terminal">
$ git push
</pre>
Your forked buildpack is now synced with the upstream Cloud Foundry buildpack.
For more information about syncing forks, see [Syncing a fork](https://help.github.com/articles/syncing-a-fork/).