Magit 真的很好,但我还没有弄清楚如何从它创建一个远程分支,或者如何刷新它知道的远程分支而不删除远程并重新添加它。
目前我去github,添加一个分支,然后进入magit,删除远程,然后再添加回来。有没有更好的办法?
最佳答案
应该使用 git fetch 来刷新远程分支。 .
与 Magit (documentation) :
Typing f f will run
git fetch
.
It will prompt for the name of the remote to update if there is no default one.Typing f o will always prompt for the remote.
Typing F F will run
git pull
.
When you don’t have a default branch configured to be pulled into the current one, you will be asked for it.
如 Rémi commented , f a 将获取所有 Remote 。
实际上,如 akaihola comments 2018年:
If you type F, you get the "pull" menu.
Then:
- p pulls from the push default (see b M-p), and
- e from elsewhere (e.g. another remote branch).
创建远程分支应该是将本地分支推送到远程:
Magit will run
git push
when you type P P.
If you give a prefix argument to P P, you will be prompted for the repository to push to.
When no default remote repository has been configured yet for the current branch, you will be prompted as well.Typing P P will only push the current branch to the remote.
In other words, it will rungit push <remote> <branch>
.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.If you give a double prefix argument to P P, you will be prompted in addition for the target branch to push to.
In other words, it will rungit push <remote> <branch>:<target>
.
关于emacs - 你如何刷新Magit中的 Remote ?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24216353/