Idea how to switch git branch


Scenario description

During the project development process, there may be different branches in different project stages. After creating a branch, you need to switch the code to this branch for code synchronization. For example, if you want to synchronize the current origin / Master > origin / dev branch, idea does not have the function of automatic synchronization, and the target branch will not be found. In this case, you need to fetch it first and look at the detailed steps. (if you can see the target branch under git, check out as directly.)


1. pull the latest content of remote host to local

Right click project, GIT, repository, fetch

2. check whether new branches can be obtained locally

Right click Project > git > repository > pull

Get target branch

3. switch to target branch

Right click project, GIT, repository, branches

Select target branch > checkout as

Default is OK

View current branch, successfully switched

This article introduces how to switch git branch in idea. For more content about idea switching git branch, please search the previous articles of developeppaer or continue to browse the related articles below. I hope you can support developeppaer more in the future!