git_branch.go 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. package git
  2. import (
  3. "fmt"
  4. "github.com/docopt/docopt-go"
  5. )
  6. func main() {
  7. usage := `usage: git branch [options] [-r | -a] [--merged=<commit> | --no-merged=<commit>]
  8. git branch [options] [-l] [-f] <branchname> [<start-point>]
  9. git branch [options] [-r] (-d | -D) <branchname>
  10. git branch [options] (-m | -M) [<oldbranch>] <newbranch>
  11. Generic options:
  12. -h, --help
  13. -v, --verbose show hash and subject, give twice for upstream branch
  14. -t, --track set up tracking mode (see git-pull(1))
  15. --set-upstream change upstream info
  16. --color=<when> use colored output
  17. -r act on remote-tracking branches
  18. --contains=<commit> print only branches that contain the commit
  19. --abbrev=<n> use <n> digits to display SHA-1s
  20. Specific git-branch actions:
  21. -a list both remote-tracking and local branches
  22. -d delete fully merged branch
  23. -D delete branch (even if not merged)
  24. -m move/rename a branch and its reflog
  25. -M move/rename a branch, even if target exists
  26. -l create the branch's reflog
  27. -f, --force force creation (when already exists)
  28. --no-merged=<commit> print only not merged branches
  29. --merged=<commit> print only merged branches
  30. `
  31. args, _ := docopt.Parse(usage, nil, true, "", false)
  32. fmt.Println(args)
  33. }