Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why is my GitHub pull request showing commits that aren't by me?

Tags:

git

github

I am confused about why a GitHub pull request is showing lots of commits that I didn't make, when I have rebased directly off current master.

I did the following:

git pull 
git checkout -b my-new-branch

Days pass while I work on stuff, then:

git add .
git commit -m 'Add my amazing commit'

Add a few more commits, then get ready to push:

git fetch
git rebase master

The rebase runs with no conflicts, so:

git push origin my-new-branch

However, when I open the branch on GitHub, it is showing my commits on top of 92 commits from other members of my team. Why is it showing these as different to master, when I have rebased off master?

like image 457
Richard Avatar asked Jun 23 '16 16:06

Richard


1 Answers

OK, it was because I hadn't updated my local master, because I'd only fetched and not pulled. Doh!

I fixed this as follows. First I updated the local master:

git checkout master
git pull

Then I created a new branch off my up-to-date copy of master:

git checkout -b my-second-branch

Then I checked what the hashes of the commits I cared about on the old branch were:

git whatchanged my-new-branch

Then I cherry-picked in the commits I cared about off the first branch, onto the second branch:

git cherry-pick hashofmyfirstcommit
git cherry-pick hashofmysecondcommit

And then I pushed the new branch:

git push origin my-second-branch

And then I created a PR off that, and deleted the old branch and the old PR.

like image 56
Richard Avatar answered Oct 27 '22 01:10

Richard