https://github.com/julian/named-branch-action
hg-style named branches via a GitHub action
https://github.com/julian/named-branch-action
bot git github-actions hg mercurial
Last synced: 5 months ago
JSON representation
hg-style named branches via a GitHub action
- Host: GitHub
- URL: https://github.com/julian/named-branch-action
- Owner: Julian
- License: mit
- Created: 2019-09-06T08:02:55.000Z (almost 7 years ago)
- Default Branch: main
- Last Pushed: 2024-01-06T15:54:18.000Z (over 2 years ago)
- Last Synced: 2025-06-04T10:27:49.638Z (about 1 year ago)
- Topics: bot, git, github-actions, hg, mercurial
- Language: Dockerfile
- Homepage:
- Size: 12.7 KB
- Stars: 1
- Watchers: 3
- Forks: 1
- Open Issues: 3
-
Metadata Files:
- Readme: README.rst
- License: LICENSE
Awesome Lists containing this project
README
==============
Named Branches
==============
An implementation of `hg-style named
branches `_ implemented via
`GitHub Actions `_ plus `git notes
`_.
Usage
-----
For the repository in question, in e.g.
``.github/workflows/named-branches.yml``:
.. code-block:: yaml
name: 'Named Branches'
on: push
permissions:
contents: write # to support pushing the notes
jobs:
named-branches:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: Julian/named-branch-action@v1
with:
github_token: '${{ secrets.GITHUB_TOKEN }}'
See `action.yml `_ for full details, or `this repository `_ for a fully worked example.
Then, in any local clone where you wish to see branch information, ensure you're fetching git notes from the remote via e.g.::
$ git config --add remote.origin.fetch "+refs/notes/*:refs/notes/*"
at which point you can show the named branch alongside ``git log`` by running::
$ git log --notes=branch
If you don't use ``git notes`` for anything else (though you should!) you can set ``git config core.notesRef refs/notes/branch`` as well, which will make commands like ``git log --notes`` work without explicitly specifying which ``ref`` the notes live in.
You can also directly check where a commit came from via::
$ git notes --ref branch show 710ca11
which will show ``refs/heads/foo`` if ``710ca11`` was committed on the ``foo`` branch.
Notes
-----
The remote repository only knows about remote branches, so if you created some commits on a local branch and then merged it into another local branch without pushing, you won't see two branches in the notes.