2

Say I have a pull request, but it is not accepted for a few weeks.

After I fetch, merge, and squash my changes, my pull request appears to involve everyone's changes for those few weeks. How do I update the point at which git considers the pull the request to be from?

git diff HEAD~1

looks perfect.

For some reason my origin's marker to where it was branched from the upstream needs to be updated, but isn't. How do I force that to update?

Neil G
  • 32,138
  • 39
  • 156
  • 257
  • Found my answer here: https://stackoverflow.com/questions/41283955/github-keeps-saying-this-branch-is-x-commits-ahead-y-commits-behind/41289258 – Neil G Apr 03 '20 at 00:09

1 Answers1

1

If the commit history at HEAD~1 is what you wish to exist in your PR, then you can reset your git state to be at that commit and force push.

$ git reset --hard HEAD~1
$ git push --force-with-lease origin <YOUR_BRANCH_NAME>
SpaceKatt
  • 976
  • 6
  • 12
  • 1
    Deleted my answer because this one is more specific to the question. – adlopez15 Apr 02 '20 at 23:45
  • Here's my change: https://github.com/NeilGirdhar/jax/commit/3ebf1547a8e8e6326cba79c22be9146f5f93780d. Here's the pull request: https://github.com/google/jax/pull/2487. I don't see why they don't match? – Neil G Apr 03 '20 at 00:01
  • The problem is that my origin needs to reset its position compared with the upstream, which is what I'm asking. – Neil G Apr 03 '20 at 00:05
  • 1
    Ah, got it "git pull --rebase upstream master" – Neil G Apr 03 '20 at 00:09