# Show a GitHub file from a branch, tag or commit in Confluence To show a GitHub file from a branch, tag or commit in Confluence, open the file on github.com at that branch, tag or commit, copy the link and paste it into the page or into the picker's search box. The macro reads the ref from the link. The picker's own browsing always uses the repository's default branch. --- ## Before you start * You can edit the Confluence page. * You know which branch, tag or commit you want. A tag or commit keeps the file fixed; a branch follows its latest commit. --- ## Steps 1. On github.com, open the file and use the branch menu to switch to the branch or tag you want. For a fixed version, open the file from a commit instead. 2. Copy the address. It looks like `https://github.com/owner/repo/blob/v2.1.0/docs/setup.md`. 3. Edit the Confluence page and paste the link on an empty line. It becomes the **Github file (Capable)** macro. 4. To change an existing macro instead, open its configuration, paste the link into **Search repositories or paste URL...**, press Enter and select **Add to page**. 5. Publish the page. --- ## What happens next The macro header shows the ref in brackets after the path, for example `(v2.1.0)`. Nothing is shown for `main`. A branch keeps moving as people commit; a tag or commit link shows the same content until you change the macro. ⚠️ Use the short `/blob//` form. A link that spells out `/blob/refs/heads/main/...` converts into a broken macro. See [this troubleshooting page](https://help.gocapable.com/git/pasted-a-link-like-github-com-owner-repo-blob-refs-heads-main-file-md-and-the-macro-is-broken.html). --- ## If it does not work * A line range such as `#L10-L20` is ignored and the whole file shows. See [Pasted a link with a line range](https://help.gocapable.com/git/pasted-a-link-with-a-line-range-like-l10-l20-but-the-whole-file-is-shown.html). * There is no branch list in the picker. That is expected. See [Cannot choose a different branch in the Browse GitHub picker](https://help.gocapable.com/git/cannot-choose-a-different-branch-in-the-browse-github-picker.html). --- ## Related ### [Auto-convert pasted GitHub links](https://help.gocapable.com/git/auto-convert-pasted-github-links.html) Which links convert, and how. ### [Github file](https://help.gocapable.com/git/github-file.html) Every setting and what the macro shows. ### [Embed a GitHub file in Confluence](https://help.gocapable.com/git/embed-a-github-file-in-confluence.html) The basic task, start to finish. ### [Macro cannot find a file in a repository that still uses master](https://help.gocapable.com/git/macro-cannot-find-a-file-in-a-repository-that-still-uses-master.html) Repositories still on master. --- _The version you meant, every time._