Working with Git in PyCharm
This is the basic workflow when working with Git with PyCharm. For the CLI version of the guide, click here.
The following will use the SeasonalBot repository as an example, but the steps are the same for all other repositories.
Note: This is a guide only meant to get you started with git. For in-depth resources, check the Working with Git page.
Adding a remote to the main GitHub repository you forked off will allow you to later update your fork with changes from the main repository.
Generally, a remote designates a repository that is on GitHub or another external location rather than on your computer. The
originremote will refer to your fork on GitHub. The
upstreamremote will refer to the main repository on GitHub.
- In the menu bar, navigate to
- In the popup menu, click the
upstreamas the name, set the URL as the URL for the main repository on GitHub.
You will be committing your changes to a new branch rather than to
master. Using branches allows you to work on multiple pull requests at the same time without conflicts.
You can name your branch whatever you want, but it's recommended to name it something succint and relevant to the changes you will be making.
Before making new branches, be sure to checkout the
masterbranch and ensure it's up to date.
- In the bottom right corner, click on
Git: masterand then click
After making changes to the project files, you can commit by clicking the commit button that's part of the Git actions available in the top right corner of your workspace:
The flow of making a commit is as follows:
1. Select the files you wish to commit.
2. Write a brief description of what your commit is. This is your commit message.
3. See the actual changes your commit will be making, and optionally tick/untick specific changes to only commit the changes you want.
When you are ready to have your commits be available in your remote fork, navigate to
Select the commits you want to push, make sure the remote branch is your intended branch to push to, and click
Sometimes you want to update your repository with changes from GitHub. This could be the case if you were working on the pull request on two different computers and one of them has an outdated local repository.
To do that, navigate to
Pull.... From there, select the remote and the branches to pull from, then click