Get the current branch. Returns: The current branch, or None if detached head.
()
| 84 | |
| 85 | |
| 86 | def get_branch() -> str | None: |
| 87 | """Get the current branch. |
| 88 | |
| 89 | Returns: |
| 90 | The current branch, or None if detached head. |
| 91 | """ |
| 92 | branch = execute("git rev-parse --abbrev-ref HEAD", error_out=True).out |
| 93 | if branch == "HEAD": # detached head |
| 94 | return None |
| 95 | return branch |
| 96 | |
| 97 | |
| 98 | def create_working_tree_permalink( |
no test coverage detected