Skip to content

[WIP] Prepare clean branch for upstream contribution - #4

Closed
caspinos with Copilot wants to merge 2 commits into
mainfrom
copilot/upstream-contribution
Closed

caspinos with Copilot wants to merge 2 commits into
mainfrom
copilot/upstream-contribution

Conversation

Copilot AI commented Mar 23, 2026

Copy link
Copy Markdown
  • Identify upstream repository: Cap-go/capacitor-fast-sql
  • Compare fork's main vs upstream main — 13 files differ (excluding README.md and package.json)
  • Create upstream-contribution branch locally based on upstream's latest main (commit df040f8)
  • Apply all improvements from fork EXCEPT README.md and package.json
  • Commit the improvements to upstream-contribution locally
  • Add GitHub Actions workflow that auto-creates upstream-contribution on push to PR branch
  • Trigger the workflow and verify upstream-contribution branch is created on origin
Original prompt

Create a Clean Feature Branch for Upstream Contribution

The user has forked a repository and made improvements, but also changed README.md and package.json with their own repository name and info. The goal is to prepare a clean branch that contains only the improvements, without any personal repo info changes, so it can be submitted as a pull request to the original upstream repository.

Tasks

  1. Identify the upstream/original repository that caspinos/capacitor-fast-sql was forked from.

  2. Compare the fork's main branch against the upstream's default branch to identify all changed files.

  3. Create a new branch (e.g., upstream-contribution) based on the upstream's latest default branch state.

  4. Apply all changes from caspinos/capacitor-fast-sql main branch EXCEPT:

    • README.md — keep the upstream version
    • package.json — keep the upstream version
  5. Commit the improvements (everything except the excluded files above) to the new branch upstream-contribution.

  6. Push the branch upstream-contribution to the caspinos/capacitor-fast-sql repository.

Expected Result

A branch named upstream-contribution in caspinos/capacitor-fast-sql that:

  • Is based on the upstream repository's latest main/default branch
  • Contains all of the user's improvements
  • Does not include any changes to README.md or package.json
  • Is ready to be used as the head branch when opening a pull request to the original upstream repo

The following is the prior conversation context from the user's chat exploration (may be truncated):

User: I've forked a repository. I've made some improvements and also changed README and package.json with my repository name and info.
I want to create pull request to the original repo with my improvements but without my repo information.
What is the bast way to do it?

Assistant: The best approach is to create a dedicated feature branch in your fork that contains only your improvements, without the README and package.json changes. Here's the step-by-step plan:


Recommended Approach: Create a Clean Feature Branch

1. Create a new branch from the original repo's latest state

In your local clone of your fork, fetch the upstream and create a clean branch from it:

# Add the original repo as upstream (if not done already)
git remote add upstream https://github.com/ORIGINAL-OWNER/ORIGINAL-REPO.git

# Fetch the latest from upstream
git fetch upstream

# Create a new branch based on upstream's main branch
git checkout -b my-improvements upstream/main

2. Cherry-pick only your improvement commits

Identify the commits that contain your actual improvements (not the README/package.json changes) and cherry-pick them:

# Find your commit SHAs
git log your-fork-branch --oneline

# Cherry-pick only the relevant commits
git cherry-pick <commit-sha-1>
git cherry-pick <commit-sha-2>
# ... repeat for each improvement commit

💡 If your improvements and repo-info changes are mixed in the same commit, you'll need to cherry-pick selectively using git cherry-pick -n <sha> (no commit), then unstage the unwanted file changes before committing.

3. Push the new branch to your fork

git push origin my-improvements

4. Open the Pull Request

Go to the original repository on GitHub and:

  1. Click "Compare & pull request" (or go to Pull requests → New pull request → compare across forks).
  2. Set base repository → original repo's main branch.
  3. Set head fork → your fork, branch my-improvements.
  4. Add a title and description, then click Create Pull Request.

See: Creating a pull request from a fork


Alternative: If commits are mixed (improvements + repo info in the same commit)

If you can't cleanly cherry-pick, use this approach:

git checkout -b my-improvements upstream/main

# Apply changes from your branch but don't commit yet
git cherry-pick -n <mixed-commit-sha>

# Restore the files you DON'T want to include
git checkout HEAD -- README.md package.json

# Commit only the improvements
git commit -m "Add my improvements"

Key Takeaway

The trick is: don't open the PR from your main/default fork branch (which has all your personal changes). Instead, use a separate branch that only includes the commits you want to contribute. This keeps your personal customizations (README, package.json) out of the upstream PR entirely.

User: prepare such brunch for this repo

Assistant: We're waiting for your response to the tool call dialog to continue.

This pull request was created from Copilot chat.


⚡ Quickly spin up Copilot coding agent tasks from anywhere on your macOS or Windows machine with Raycast.

Copilot AI requested a review from caspinos March 23, 2026 11:43
Copilot stopped work on behalf of caspinos due to an error March 23, 2026 11:43
@caspinos caspinos closed this Mar 23, 2026
@caspinos
caspinos deleted the copilot/upstream-contribution branch March 23, 2026 11:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants