# read_git_branch_from_filesystem

> **Function** in `deepagents_code`

📖 [View in docs](https://reference.langchain.com/python/deepagents-code/_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/0412009c5441bef8d75a427e1da8909e33ab5b56/libs/code/deepagents_code/_git.py#L159)