3 ms·
This isn't really "pinning" a pull request. The problem is not that "GitHub Pull Requests are dynamic". Any branch name is just an alias for the latest commit
by kwamenum86 14y ago
This isn't really "pinning" a pull request. The problem is not that "GitHub Pull Requests are dynamic".
Any branch name is just an alias for the latest commit in that branch. For example master is just an alias for the latest commit in master so you can reference that commit without the SHA1 hash. When I submit a pull request for foo/master then push new commits for foo/master, I just changed what master points to so my pull request changes. By using the commit hash you avoid the commit alias problem because new commits won't change what a commit hash references.
In fact, virtually anywhere you use a branch name in git or github you can also use a commit hash.
- zacharyvoase 14y agoSure, but I'm a git luser—and I'm sure I'm in the same boat as a lot of people in thinking of 'branches' as a named branch of code in the graph, not as a kind of floating pointer to a commit. I never presented this as a problem. But clearly the nature of GitHub's pull request UI is sufficiently misleading (or the documentation sufficiently incomplete) to wrongly convince some smart people that pull requests can always change while you're reviewing them, and that there's nothing you can do about that. In this case, that misunderstanding caused them to ignore the entire feature. I just wanted to point out a neat trick that (probably) not many others had spotted before. Now, in actual fact I would personally choose to use standard branch-based pull requests anyway, because you get to rebase your branch while work progresses on master. But then again I've never worked on an open-source project with so many interested parties, contributors or even regular committers.
- kwamenum86 14y agoThanks for sharing. I didn't realize you can do that with Github before reading your post.
- ajross 14y agoNo, but that's misunderstanding the problem. The 1:1 relationship of a branch HEAD to a pull request is an implementation detail (that happens to be exploited here). The problem is that github thought it was a good idea to "review" such an object at all. It's the wrong data structure for that. What you want to review is a series of patches, which is also a data structure git supports, but not (quite) 1:1 with a branch head.