Link latest file on Bitbucket Git repository

天大地大妈咪最大 提交于 2019-11-28 21:19:15

问题


I have a public Git repository on Bitbucket. I want to link the latest version of a Read-Me file. Here's the link to a revision/commit:

https://bitbucket.org/wordless/thofu-interpreter/raw/5bfc37864c5d/ThoFu%20Interpreter/ReadMe.txt

I tried to replace the revision number with tip and default, but it didn't work. Is there any way to get a permanent link to my latest files?


回答1:


Two ideas:

Use master in the url (this seems to work):

https://bitbucket.org/wordless/thofu-interpreter/raw/master/ThoFu%20Interpreter/ReadMe.txt

Another idea is to create a wiki page for your project, then use the wiki's functionality to link to the latest version of a file with this syntax:

<<file path/to/file [revision] [linenumber]>>

Just omit the revision and line number parameters, they are optional.

Then, refer to the wiki page everywhere else you'd like link to the read me file.




回答2:


There is an easy workaround for this issue by updating your relative links to src/[branch_name]/path/to/file. Works like a charm for me.




回答3:


The canonical way to add a link to a file in your repository using Markdown (the default for Readme files and Wiki pages) is by linking to the relative path of the file.

For example, if I had a structure like so:

<repo root>
|-- my-file.txt
|    
|-- my-dir 
|    |-- my-other-file

I'd be able to link to them as follows:

[my-file](my-file.txt)
[my-dir](my-dir)
[some-other-file](my-dir/some-other-file)

Bitbucket will then automatically link to the file at the current branch that you are viewing the file at. If you're viewing the Readme file in the overview that will mean the default branch (usually 'master').




回答4:


I am using master like this for the last zip file of the code :

https://bitbucket.org/MIUSER/MIREPO/get/master.zip

Where MIUSER is my user and MIREPO is the name of my app.

Hope that this works :D.




回答5:


Here are working links:

RAW:

https://bitbucket.org/wordless/thofu-interpreter/raw/HEAD/TODO.txt?at=master&fileviewer=file-view-default

Source:

https://bitbucket.org/wordless/thofu-interpreter/src/HEAD/TODO.txt?at=master&fileviewer=file-view-default


来源:https://stackoverflow.com/questions/11692124/link-latest-file-on-bitbucket-git-repository

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!