Represents the result of a git checkout branch operation.
Returned by Git.checkout/1 when switching to or creating a branch.
For file restore operations, {:ok, :done} is returned instead.
Summary
Functions
Parses the output of git checkout for branch operations.
Types
Functions
Parses the output of git checkout for branch operations.
Handles the following output patterns:
"Switched to a new branch 'name'"— created and switched"Switched to branch 'name'"— switched to existing branch"Already on 'name'"— already on the requested branch
Examples
iex> Git.Checkout.parse("Switched to a new branch 'feat/new'\n")
%Git.Checkout{branch: "feat/new", created: true}
iex> Git.Checkout.parse("Switched to branch 'main'\n")
%Git.Checkout{branch: "main", created: false}
iex> Git.Checkout.parse("Already on 'main'\n")
%Git.Checkout{branch: "main", created: false}