Commit d6b8ea24 authored by Jonas Bernoulli's avatar Jonas Bernoulli

magit-remote-{set,unset}-head: new commands

parent 3aec1c74
...@@ -9,6 +9,9 @@ Updates since v2.4.1 ...@@ -9,6 +9,9 @@ Updates since v2.4.1
to <upstream>" to "Unmerged into <upstream>", because one usually to <upstream>" to "Unmerged into <upstream>", because one usually
should merge into that branch instead of pushing to it. should merge into that branch instead of pushing to it.
* Added new commands `magit-remote-set-head' and
`magit-remote-unset-head'.
Fixes since v2.4.1 Fixes since v2.4.1
------------------ ------------------
......
...@@ -140,6 +140,27 @@ the variable isn't already set." ...@@ -140,6 +140,27 @@ the variable isn't already set."
(interactive (list (magit-read-remote "Delete remote"))) (interactive (list (magit-read-remote "Delete remote")))
(magit-run-git "remote" "rm" remote)) (magit-run-git "remote" "rm" remote))
;;;###autoload
(defun magit-remote-set-head (remote &optional branch)
"Set the local representation of REMOTE's default branch.
Query REMOTE and set the symbolic-ref refs/remotes/<remote>/HEAD
accordingly. With a prefix argument query for the branch to be
used, which allows you to select an incorrect value if you fancy
doing that."
(interactive
(let ((remote (magit-read-remote "Set HEAD for remote")))
(list remote
(and current-prefix-arg
(magit-read-remote-branch (format "Set %s/HEAD to" remote))))))
(magit-run-git "remote" "set-head" remote (or branch "--auto")))
;;;###autoload
(defun magit-remote-unset-head (remote)
"Unset the local representation of REMOTE's default branch.
Delete the symbolic-ref \"refs/remotes/<remote>/HEAD\"."
(interactive (list (magit-read-remote "Unset HEAD for remote")))
(magit-run-git "remote" "set-head" remote "--delete"))
;;; Fetch ;;; Fetch
;;;###autoload (autoload 'magit-fetch-popup "magit-remote" nil t) ;;;###autoload (autoload 'magit-fetch-popup "magit-remote" nil t)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment