Skip to content

Commit

Permalink
add av branch --split to manpages (#504)
Browse files Browse the repository at this point in the history
  • Loading branch information
tulioz authored Jan 3, 2025
1 parent 4a35b85 commit f1da076
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 3 deletions.
15 changes: 12 additions & 3 deletions cmd/av/branch.go
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,11 @@ func branchSplit(repo *git.Repo, db meta.DB, currentBranchName string, newBranch
currentBranchRef, err := repo.GoGitRepo().Reference(currentBranchRefName, true)

if err != nil {
return fmt.Errorf("failed to get reference for current branch %s: %w", currentBranchName, err)
return fmt.Errorf(
"failed to get reference for current branch %s: %w",
currentBranchName,
err,
)
}

lastCommitHash := currentBranchRef.Hash()
Expand Down Expand Up @@ -215,7 +219,12 @@ func branchSplit(repo *git.Repo, db meta.DB, currentBranchName string, newBranch

fmt.Fprint(
os.Stdout,
colors.Success(fmt.Sprintf("Successfully split the last commit into a new branch %s.\n", newBranchName)),
colors.Success(
fmt.Sprintf(
"Successfully split the last commit into a new branch %s.\n",
newBranchName,
),
),
)

// Adopt new branch to av database
Expand Down Expand Up @@ -265,7 +274,7 @@ func init() {
branchCmd.Flags().
BoolVar(&branchFlags.Force, "force", false, "force rename the current branch, even if a pull request exists")
branchCmd.Flags().
BoolVar(&branchFlags.Split, "split", false, "split the last commit into a new branch")
BoolVar(&branchFlags.Split, "split", false, "split the last commit into a new branch, if no branch name is given, one will be auto-generated")

_ = branchCmd.RegisterFlagCompletionFunc(
"parent",
Expand Down
4 changes: 4 additions & 0 deletions docs/av-branch.1.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,3 +31,7 @@ metadata with `av branch --rename <old-branch-name>:<new-branch-name>`.

`--force`
: Force rename the branch, even if a pull request exists.

`--split`
: Splits the last commit into a new branch, if no branch name is given
create one based on commit message.

0 comments on commit f1da076

Please sign in to comment.