# 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/caaa7e7c12d214afa5cf0a1afed8eb6232aa6f7b/libs/code/deepagents_code/_git.py#L469)