Nats
Nats

Reputation: 11

Rebase a PR from a forked repo into the parent

I am working in a forked repo and need to PR into the main parent repo to ensure my changes go to production. I can raise the PR in the main repo but I am picking up a massive git history even after rebasing my fork. Is there a way I can rebase my working branch in the fork (my_repo/my_branch) to the parent/main branch and get rid of the unnecessary commits?

Upvotes: 0

Views: 206

Answers (1)

knittl
knittl

Reputation: 265585

"Massive Git history" doesn't make sense (and rebase likely isn't going to solve that). Which commits are selected to be merged any why do they only exist in your fork and not the original repo?

That said, rebasing to commits of a different "fork" can be done easily. You need to have the commits of the original repo so that you can rebase

git remote add original https://github.com/project/repo.git
git fetch original
git rebase original/master yourbranch

Upvotes: 1

Related Questions