From 9b195b61e92c66ee73b1712f9b44c8893353320b Mon Sep 17 00:00:00 2001 From: Nathan Weizenbaum Date: Thu, 24 Jun 2010 16:40:28 -0700 Subject: [PATCH 1/3] Properly handle pushing a branch without a remote. Before, this did "git push remote branch-name:nil". Now it does "git push remote branch-name". Git automatically sets up the remote. --- magit.el | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/magit.el b/magit.el index c03ad68d..6ca688e9 100644 --- a/magit.el +++ b/magit.el @@ -3042,7 +3042,10 @@ 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)))) ;;; Log edit mode From a5b72daa029118db62d5a2530966131be50cd7be Mon Sep 17 00:00:00 2001 From: Nathan Weizenbaum Date: Thu, 24 Jun 2010 16:56:18 -0700 Subject: [PATCH 2/3] When pushing a new branch, manually add merge configuration. --- magit.el | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/magit.el b/magit.el index 6ca688e9..311e760a 100644 --- a/magit.el +++ b/magit.el @@ -3045,7 +3045,12 @@ typing and automatically refreshes the status buffer." (magit-run-git-async "push" "-v" push-remote (if ref-branch (format "%s:%s" branch ref-branch) - 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 From 9cc5e7e5d2e8f961fe6a4b19be0e362faf84fd3c Mon Sep 17 00:00:00 2001 From: Nathan Weizenbaum Date: Thu, 24 Jun 2010 17:17:58 -0700 Subject: [PATCH 3/3] Document the new branch behavior. --- magit.texi | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) 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