Branching and merging processes can be accomplished quite effortlessly in PyCharm. In the bottom-right corner of your project window, click on the Git button, which will bring up the following dropdown in which we can manage the branches for our project:
As you can see, in this menu we can create a new branch for our project. Go ahead and create a new branch and make a change to the main.py file in our project. For example, I named my new branch branch1 and changed the code in main.py too:
if __name__ == '__main__':
print('Hello from Version Control!')
print('Change in branch 1.')
From here, you can switch back and forth between different branches in the same menu by selecting a specific branch and choose Checkout. For example, selecting the following will bring you back to the master branch of our current project:
From the same menu, you can choose to rename or delete a branch, or more importantly, implement a merge between two branches by selecting Merge into Current.