# resolve_git_branch

> **Function** in `deepagents_code`

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

Resolve the current git branch with a filesystem-first strategy.

## Signature

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

## Parameters

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

## Returns

`str`

The current branch name, `HEAD` for detached HEAD, or an empty string

---

[View source on GitHub](https://github.com/langchain-ai/deepagents/blob/a98f0dfa8d534d8a1885b524632400e52db22ac6/libs/code/deepagents_code/_git.py#L223)