Bitbucket and PyCharm – Tools to make a DPhil less problematic

I find Git a wonderful tool for my work, with version control providing much needed damage control to my projects. I also find Git incredibly powerful at making my working life easier, with the ability to use git push and git pull to synchronise my code between the various computers that I use for my DPhil. Via a BitBucket account, providing a remote Git repository, I am able to move my code around to wherever I am working and allow more room for either more procrastination or staring at my screen in confusion.

As simple as GIT is, it can be a fiddle entering the git commands in command line as well as remembering to do this as you rush to leave the building. This has all been made much easier with PyCharm, from JetBrains. This IDE (integrated development environment) has many tools including version control such as support for a variety of file types, PEP8 checks to ensure good quality code and its ability to work with ipython notebooks.

I’ve put the following mini-tutorial together for those who want to make or bring in an existing repository to PyCharm and get version control working:

To clone a repository and get going in PyCharm:
1) Make your repository, for this example I will use BitBucket:

2) Open up PyCharm, then select ‘Check Out from Version Control’ > Bitbucket. You might be asked to log in at this stage, if you are using the account for the first time. It is also useful to say that there are many supported online repositories here e.g. Github.

3) Select the repository from your account, where you would like it to clone to on your machine and give it a fetching name. When promoted, agree to make the directory.

To add a local file to your repository (‘git add’):
VCS > Git > Add
You are now able to send it to your remote repository…

To push:
VCS > Git > Push OR The useful green up arrow:

Add a commit comment and then click Commit > Commit & Push.¬†You will get a nice pop up asking which branch to push it to, which will be the Master unless you’ve branched out.

To pull from your remote repository to your local machine:
VCS > Git >Pull OR The equally useful blue down button (above), assuming that you have already cloned the project to this local machine.