([?\C-c ?\C-/] . stgit-redo)
("\C-c\C-_" . stgit-redo)
("B" . stgit-branch)
+ ("\C-c\C-b" . stgit-rebase)
("t" . ,toggle-map)
("d" . ,diff-map)
("q" . stgit-quit)))))
Commands for branches:
\\[stgit-branch] Switch to another branch
+\\[stgit-rebase] Rebase the current branch
Customization variables:
`stgit-abbreviate-copies-and-renames'
(stgit-capture-output nil (stgit-run "branch" "--" branch))
(stgit-reload))
+(defun stgit-available-refs (&optional omit-stgit)
+ "Returns a list of the available git refs.
+If OMIT-STGIT is not nil, filter out \"resf/heads/*.stgit\"."
+ (let* ((output (with-output-to-string
+ (stgit-run-git-silent "for-each-ref" "--format=%(refname)"
+ "refs/tags" "refs/heads"
+ "refs/remotes")))
+ (result (split-string output "\n" t)))
+ (mapcar (lambda (s)
+ (if (string-match "^refs/\\(heads\\|tags\\|remotes\\)/" s)
+ (substring s (match-end 0))
+ s))
+ (if omit-stgit
+ (delete-if (lambda (s)
+ (string-match "^refs/heads/.*\\.stgit$" s))
+ result)
+ result))))
+
+(defun stgit-rebase (new-base)
+ "Rebase to NEW-BASE."
+ (interactive (list (completing-read "Rebase to: "
+ (stgit-available-refs t))))
+ (stgit-capture-output nil (stgit-run "rebase" new-base))
+ (stgit-reload))
+
(defun stgit-commit (count)
"Run stg commit on COUNT commits.
Interactively, the prefix argument is used as COUNT.