{"id":16199896,"url":"https://github.com/agateau/git-uff","last_synced_at":"2025-03-19T05:30:54.007Z","repository":{"id":57434858,"uuid":"332250421","full_name":"agateau/git-uff","owner":"agateau","description":"Prints the forge url for a given file of a Git repository checkout","archived":false,"fork":false,"pushed_at":"2025-01-21T08:08:47.000Z","size":32,"stargazers_count":6,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-13T13:09:10.120Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/agateau.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2021-01-23T16:04:27.000Z","updated_at":"2025-01-21T08:08:52.000Z","dependencies_parsed_at":"2022-09-04T15:32:28.212Z","dependency_job_id":null,"html_url":"https://github.com/agateau/git-uff","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/agateau%2Fgit-uff","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/agateau%2Fgit-uff/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/agateau%2Fgit-uff/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/agateau%2Fgit-uff/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/agateau","download_url":"https://codeload.github.com/agateau/git-uff/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243971189,"owners_count":20376784,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-10-10T09:28:38.079Z","updated_at":"2025-03-19T05:30:53.742Z","avatar_url":"https://github.com/agateau.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# git-uff\n\nPrints the forge URL for a given file of a Git repository checkout.\n\n## Intro\n\nHave you ever been discussing with colleagues over IRC/Slack/Matrix/whatever about source code and found yourself needing to point them to a particular file in a git repository?\n\nThis is tedious to do.\n\nOne solution is to tell them the path in their checkout, hoping they are on the same branch as you.\n\nAnother solution is to point your browser to the forge hosting your git repository, select the right branch, navigate the file hierarchy, find your file and copy the file URL.\n\nA better (in my opinion 😉) solution is to use `git-uff`. This tool adds an `uff` (short for \"URL for file\") git sub-command, which takes the path to a file in your repository checkout and prints the matching forge URL.\n\nFor example to print the URL of the `src/linux/nanonote.desktop` file from my [Nanonote][] project:\n\n```\n$ git uff src/linux/nanonote.desktop\nhttps://github.com/agateau/nanonote/blob/master/src/linux/nanonote.desktop\n```\n\n[Nanonote]: https://github.com/agateau/nanonote\n\nYou can also point them to a specific line with the `-l` argument:\n\n```\n$ git uff src/linux/nanonote.desktop -l 10\nhttps://github.com/agateau/nanonote/blob/master/src/linux/nanonote.desktop#L10\n```\n\n`git-uff` has a few other available options. Here is its `--help` output:\n\n\u003c!-- [[[cog\nimport subprocess\nresult = subprocess.run([\"git-uff\", \"--help\"], capture_output=True, text=True)\ncog.outl(\"```\")\ncog.out(result.stdout)\ncog.outl(\"```\")\n]]]--\u003e\n```\nusage: git-uff [-h] [-b BRANCH] [-p] [-c] [-l LINE] path\n\nPrints the forge URL for a given file or path of a Git repository checkout.\n\npositional arguments:\n  path                  File for which we want the URL\n\noptional arguments:\n  -h, --help            show this help message and exit\n  -b BRANCH, --branch BRANCH\n                        Use branch BRANCH instead of the current one\n  -p, --permalink       Replace the branch in the URL with the commit it\n                        points to\n  -c, --copy            Copy the result to the clipboard\n  -l LINE, --line LINE  Line to point to\n\nNew forges can be declared in git configuration. You can do so using\n`git config`, like this:\n\n    git config --global uff.\u003cforge_base_url\u003e.forge \u003cforge\u003e\n\nWhere \u003cforge\u003e must be one of: cgit, github, gitlab, sourcehut.\n\nFor example to declare that example.com uses GitLab:\n\n    git config --global uff.example.com.forge gitlab\n```\n\u003c!--[[[end]]] --\u003e\n\n## What if my code is not on GitHub?\n\n`git-uff` is not tied to GitHub. It supports GitLab, SourceHut and CGit forges.\n\nTo declare a new forge, add it to your git configuration with:\n\n    git config --global uff.\u003cforge_base_url\u003e.forge \u003cforge\u003e\n\nFor example to declare that example.com uses GitLab:\n\n    git config --global uff.example.com.forge gitlab\n\nSee the output of `git uff --help` for the valid `\u003cforge\u003e` values.\n\n## Installation\n\nThe recommended method to install `git-uff` is to use [pipx][]:\n\n```\npipx install git-uff\n```\n\n[pipx]: https://github.com/pipxproject/pipx\n\nBut you can also install it with `pip`:\n\n```\npip install --user git-uff\n```\n\n## License\n\nApache 2.0\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fagateau%2Fgit-uff","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fagateau%2Fgit-uff","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fagateau%2Fgit-uff/lists"}