summaryrefslogtreecommitdiffstats
path: root/pkg/commands/git.go
diff options
context:
space:
mode:
authorJesse Duffield <jessedduffield@gmail.com>2018-08-21 23:45:27 +1000
committerGitHub <noreply@github.com>2018-08-21 23:45:27 +1000
commit4d635cd1cd7ed1a32e516d3d93a0449d3c3a130e (patch)
tree8c3179aae788d168cb9b3929618117dbaad050f6 /pkg/commands/git.go
parent3d49ab666676ede1b3c849d56ccd2099a7701709 (diff)
parent182e47511626fb01e05b2abcaa589604648959d5 (diff)
Merge pull request #151 from alcohol/force-delete-branch
add option to force delete given branch
Diffstat (limited to 'pkg/commands/git.go')
-rw-r--r--pkg/commands/git.go10
1 files changed, 8 insertions, 2 deletions
diff --git a/pkg/commands/git.go b/pkg/commands/git.go
index bf9aa6646..ed42ae28c 100644
--- a/pkg/commands/git.go
+++ b/pkg/commands/git.go
@@ -223,8 +223,14 @@ func (c *GitCommand) NewBranch(name string) error {
}
// DeleteBranch delete branch
-func (c *GitCommand) DeleteBranch(branch string) error {
- return c.OSCommand.RunCommand("git branch -d " + branch)
+func (c *GitCommand) DeleteBranch(branch string, force bool) error {
+ var command string
+ if force {
+ command = "git branch -D "
+ } else {
+ command = "git branch -d "
+ }
+ return c.OSCommand.RunCommand(command + branch)
}
// ListStash list stash