# read_git_branch_from_filesystem

> **Function** in `deepagents_cli`

📖 [View in docs](https://reference.langchain.com/python/deepagents-cli/_git/read_git_branch_from_filesystem)

Read the current git branch from repository metadata.

## Signature

```python
read_git_branch_from_filesystem(
    path: str | Path,
) -> str | None
```

## Parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `path` | `str \| Path` | Yes | Directory or file path inside a repository. |

## Returns

`str | None`

The abbreviated branch name, `HEAD` for detached HEAD, an empty string

---

[View source on GitHub](https://github.com/langchain-ai/deepagents/blob/64d45f67c86edb4df2ced0e7b82f1a8fd158ec8c/libs/cli/deepagents_cli/_git.py#L159)