aarjithn
aarjithn

Reputation: 1181

Change branching point in git

We have two branches Branch1 and Branch2 which differs each other by 100 commits. I had created a new branch BranchA from Branch1. No commits have been made on BranchA.

Is there a way to change BranchA to appear it was branched from Branch2, so that I can make a commit and raise a pull request against Branch2 - but it won't carry any commits from Branch1?

Upvotes: 1

Views: 291

Answers (1)

Sébastien Dawans
Sébastien Dawans

Reputation: 4626

Since no commits have been added to BranchA yet, you can simply reset it to Branch2:

git checkout BranchA
git reset --hard Branch2

Had there been any commits on BranchA that you needed to keep, you could have opted for a rebase:

git checkout BranchA
git rebase Branch2

Upvotes: 5

Related Questions