diff --git a/magit.el b/magit.el index 0de0bfcf..3af0ad3b 100644 --- a/magit.el +++ b/magit.el @@ -3045,7 +3045,15 @@ typing and automatically refreshes the status buffer." (if (and (not branch-remote) (not current-prefix-arg)) (magit-set push-remote "branch" branch "remote")) - (magit-run-git-async "push" "-v" push-remote (format "%s:%s" branch ref-branch)))) + (magit-run-git-async "push" "-v" push-remote + (if ref-branch + (format "%s:%s" branch ref-branch) + branch)) + ;; Although git will automatically set up the remote, + ;; it doesn't set up the branch to merge (at least as of Git 1.6.6.1), + ;; so we have to do that manually. + (unless ref-branch + (magit-set (concat "refs/heads/" branch) "branch" branch "merge")))) ;;; Log edit mode diff --git a/magit.texi b/magit.texi index 5955aa6b..23c8d528 100644 --- a/magit.texi +++ b/magit.texi @@ -649,10 +649,12 @@ it, like from any other diff. Magit will run @code{git push} when you type @kbd{P}. If you give a prefix argument to @kbd{P}, you will be prompted for the repository to -push to. When no default remote repositor has been configured yet for +push to. When no default remote repository has been configured yet for the current branch, you will be prompted as well. Typing @kbd{P} will -only push the current branch to the remote. In other words, it will -run @code{git push }. +only push the current branch to the remote. In other words, it will run +@code{git push }. The branch will be created in the +remote if it doesn't exist already. The local branch will be configured +so that it pulls from the new remote branch. Typing @kbd{f} will run @code{git remote update}. With a prefix arg, it will prompt for the name of the remote to update. Typing @kbd{F} will