Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
691 views
in Technique[技术] by (71.8m points)

git - Find a Pull Request on GitHub where a commit was originally created

Pull Requests are great for understanding the larger thinking around a change or set of changes made to a repo. Reading pull requests are a great way to quickly "grok" a project as, instead of small atomic changes to the source, you get larger groupings of logical changes. Analogous to organizing the lines in your code into related "stanzas" to make it easier to read.

I find myself looking at a file or a commit, and I wonder if there is a way to backtrack the commit to the Pull Request that originally created it. That Pull Request would have been merged eventually, but not necessary with a merge-commit.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

You can just go to GitHub and enter the SHA into the search bar, make sure you select the "Issues" link on the left.

UPDATED 13 July 2017

Via the GitHub UI there is a now a really easy way to do this. If you are looking at a commit in the list of commits in a branch in the UI, click on the link to the commit itself. If there is a PR for that commit and it wasn't added directly to the branch, a link to the PR listing the PR number and the branch it went into will be directly under the commit message at the top of the page. enter image description here


Example of finding a PR by clicking on a link to the commit

If you have the commit SHA and nothing else and don't want to go digging around for it, just add /commit/[commit SHA] to the repo url, and you will see the commit page, with the PR link if it exists. For example, if the SHA is 52797a7a3b087231e4e391e11ea861569205aaf4 and the repo is https://github.com/glimmerjs/glimmer-vm , then go to https://github.com/glimmerjs/glimmer-vm/commit/52797a7a3b087231e4e391e11ea861569205aaf4


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

1.4m articles

1.4m replys

5 comments

56.8k users

...