So now that you've seen the power of Git and GitHub, it's time to put our blog project under version control. We're going to see how you can do this within the PyCharm GUI.
1. You can either use the final version of your blog project, or download a fresh, completed copy from the previous lesson's resources.
2. Open the project in Pycharm and run it to make sure that everything is working as expected. If you downloaded my version, then install all the required packages. An admin user is already registered in the database:
Admin account email: admin@email.com
Admin account password: asdf
Let's put our project under version control. You can do this using the Terminal or the graphical user interface (GUI).
3. Enable git as your local version control system. In the PyCharm GUI go to VCS -> Enable Version Control Integration. This is equivalent to typing git init
in the Terminal.
Make sure that you select Git when asked which version control system to use:
If successful, you should now have a new Git Pane where you can see the Git Console and Git Logs.
All the files in our project will turn red because they are not yet added to the staging area to be tracked by git.
4. Add and commit your files to version control using the Commit tool. The files and folders (e.g., PyCharm's .idea folder) listed in the .gitignore file will be excluded. The Commit tool window will become visible on the side after you've enabled version control.
Add all the unversioned files, write your commit message and click "commit".
All the tracked files should now no longer be red.
If successful, you should now be able to see your first commit in the Git Log pane: