通过 github,我们可以使用表单的 URL
www.github.com/username/repo/filename.c#L20-L45
请注意末尾的
#L20-L45
,它会在浏览器中加载页面时突出显示第 20 到 45 行代码。这个约定在 stash/bitbucket 中的工作方式似乎不同 - 是否可以以某种方式链接到某些代码行?
最佳答案
在 BitBucket 中,URL 应该以 #lines-x:y
结尾
例子:
https://bitbucket.org/stangenberg/docker-docker/src/1ac537b84855db2cc5ee0caf31c782900e094d8e/docker.sh#lines-13:15
关于 Stash(现在是 2019+ renamed BitBucket Server ),Stash 3.8 in 2015 应该支持多行选择的深度链接。 Issue BSERV-2477
With just shift+click, a developer can select a range of lines, then add separate lines to the selection with command+click (or control+click), then copy the URL and share their selection with other developers.
The OP 确认 in the comments :
The stash url generated has
#13-15
at the end, i.e. it is of the form:
https://bitbucket.org/stangenberg/docker-docker/src/1ac537b84855db2cc5ee0caf31c782900e094d8e/docker.sh#13-15
正如 cellepo 指出的 in the comments :
https://bitbucket.../pull-requests/...
)中完成,但是
https://bitbucket.../src/...
)上完成,就像前面提到的示例 URL 一样。 关于github - 链接到 stash/bitbucket 中的特定代码行?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/59743484/