Reputation: 11307
I've had a situation where a PR diff (from a feature branch to master) is different to a diff generated by comparing that ame feature branch to master.
The only thing I can think of is that GitHub 'freezes' the PR diff at the time of creation, and then that diff gets 'outdated' as master moves on (other feature branches get merged in).
Does GitHub 'freeze' PR diffs? If so, is there any way to 'refresh' it? Or is there a different reason for the diffs to be different?
Upvotes: 5
Views: 1506
Reputation: 42354
Essentially yes; Git will freeze the diff of the PR at the point at which the PR was created. If something else has been merged into master
subsequent to you creating the PR, the head
sections will differ, and as such the diff
will also differ.
In order to see only your changes (and not those made to master
in the mean-time), you can use the triple-dot syntax:
git diff develop...master
This will essentially show you the "merge base" of these two branches (the last common commit):
If additional work is required on the same branch after a pull request is merged, you can still create a subsequent commit on that feature branch and then create a second pull request. This will have the same effect of creating an independent feature branch for the second commit, though this can be useful for tracking associated work. Note that the subsequent pull request would carry the changes from both commits; it contains all of the first commit plus any changes made after it. As such, there is no difference between choosing to merge both pull requests or only merging the latter.
Upvotes: 1