1

I created branch A of master branch. I made changes and raised pull request to master branch. When I open New Pull request to master branch, I see too many files changes and previous commit with my changes and commit.

I only made changes in 9 files and 1 commit. It shows 87 commit and 30 file changes

I dont know how to solve. I created new branch, off master, took latest and tried. But same result again and again. Please help. Its frustating, I already spend hours

Dharmisha Doshi
  • 137
  • 3
  • 9

1 Answers1

10

It looks like you are branching off of master and then not updating your branch with the new updates from master. You can get the new commits in your branch and sync up the history with a Rebase -https://git-scm.com/docs/git-rebase

I'd recommend the following process which is easy to follow:

git checkout master

git pull

git checkout [feature branch]

git rebase origin/master -i

git push origin [feature-branch] --force

In the rebase step you can pick all your commits or you can squash them using the s or squash option next to your commits instead of the default pick that appears next to your commits when the text editor opens for your interactive rebase.

After that the history of your master branch should be synced up with the history of your feature branch and only your commit will show up (I recommend squashing all those merge commits- if you follow this rebase workflow you wouldn't even need to do any merges, you can just do rebases- which doesn't add their own commits).

Ashish Shah
  • 1,047
  • 7
  • 17
  • You saved my life. I'm working on a monolith, and couldn't update because of the vacation. It was showing 9000 commits diff. Thanks man. – Ajay Kumar Jun 13 '23 at 18:29