diff options
| author | Russ Cox <rsc@golang.org> | 2015-01-30 11:50:36 -0500 |
|---|---|---|
| committer | Russ Cox <rsc@golang.org> | 2015-01-30 18:19:27 +0000 |
| commit | 0dfa64fa8ebb5b99dcf6b5a3f6684441d90a37d7 (patch) | |
| tree | 1c9c4912a9186f9ff3cd0500fe02a2c12402a4bd /git-codereview/branch.go | |
| parent | c283ee0bf4c9a58240df02dc6bc62152ee935fb4 (diff) | |
| download | go-x-review-0dfa64fa8ebb5b99dcf6b5a3f6684441d90a37d7.tar.xz | |
git-codereview: add rebase-work command
Shorthand for git rebase -i $(git codereview branchpoint).
Suggested alias: rw = codereview rebase-work.
Change-Id: I4c489064fc6fced8b18cf528b77ae36b9a1c7f06
Reviewed-on: https://go-review.googlesource.com/3622
Reviewed-by: Rob Pike <r@golang.org>
Diffstat (limited to 'git-codereview/branch.go')
| -rw-r--r-- | git-codereview/branch.go | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/git-codereview/branch.go b/git-codereview/branch.go index 48ba8bb..38933b0 100644 --- a/git-codereview/branch.go +++ b/git-codereview/branch.go @@ -351,3 +351,15 @@ func branchpoint(args []string) { expectZeroArgs(args, "sync") fmt.Fprintf(stdout(), "%s\n", CurrentBranch().Branchpoint()) } + +func rebasework(args []string) { + expectZeroArgs(args, "rebase-work") + b := CurrentBranch() + if HasStagedChanges() || HasUnstagedChanges() { + dief("cannot rebase with uncommitted work") + } + if len(b.Pending()) == 0 { + dief("no pending work") + } + run("git", "rebase", "-i", b.Branchpoint()) +} |
