Magit is really nice, but I have yet to figure out how to create a remote branch from it, or how to refresh the remote branches it knows without deleting the remote and adding it back in. Currently I go to github, add a branch, then go into magit, delete the remote, and then add it back. Is there a better way?
Refreshing a remote branch should be done with a git fetch.
With 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.
As Rémi commented, f a would fetch all remotes.
Actually, as akaihola comments in 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).
Creating a remote branch should be pushing a local branch to a remote:
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>
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With