How can I refresh remote Git branches?

已回答
Hi,

There is a new branch in the remote repository, but it does not appear in the branches pop-up. How can I refresh that list to show the new branch?

Thanks,
Josh
8
Of course, I found the answer right after posting this question (I swear I looked around for an answer before asking!)

I had to use the "VCS > Git > Fetch" command
39

@Josh , 5 years late, but Thank You!

7

In future "VCS > Git > Fetch" command will save your work time.

I think that this command must to be included in all Git tutorials and used more than 10 times for better remembering.

2

Note that doing a command line git fetch is not sufficient. One must do the git fetch in the ide in order to trigger the ide to update it's list. 

[no longer banging head against wall.]

Ed Greenberg

5

Not gonna lie, this is DUMB.
JetBrains, can you please do this automagically when we run "git fetch --al" or similar from the terminal? Even if it has to be in the Rider terminal, I'd be ok with that.

3

> JetBrains, can you please do this automagically when we run "git fetch --al" or similar from the terminal?

This wouldn’t be my preferred solution. Isn’t it possible to just get the new branches with a simple Pull, like Tortoise GIT is (afaik) doing it?

-2

I actually have the other way around problem. I have remote branches that are already deleted in github, but intellij somehow still keeps them in the list of the remote branches, and they are not removed. VCS->Git->Fetch didn't help

1

Genrym, to prune remote branches that were deleted from the server, you need to run this from the command line:

git remote prune origin

It would be nice if IntelliJ did this pruning automatically when performing VCS->Git->Fetch, or at least provide a separate menu option for this under VCS->Git.

It would be even better if IntelliJ would just let you enable automatic Fetch/Prune every minute in the background - that way we wouldn't have to deal with this crap at all in most cases.

 

5

Thanks Grnch - this will help for the meantime

0
git remote prune origin

this still can't help me to update Remote Branches list, to remove the legacy branches

I have to delete them one by one carefully

0

Grnch Thank you. Just wasted an hour on this. Oddly, CLion actually disables the "delete" option on deleted remote branches, which is exactly the opposite of what we want! At the very least an option to prune would be nice. 

0

请先登录再写评论。