Version control with Git#
The collaborative development of PsyNet is underpinned by the version control system ‘Git’. Git is also used by the majority of open-source software projects across the world. It is a rather complex tool and can be legendarily frustrating for first-time users. However its functionality is indispensable in enabling multiple programmers to work on the same code-base simultaneously, each making their own modifications and feature implementations in their own workspaces, and progressively feeding the results into the common codebase.
You will have probably installed Git already as part of the PsyNet installation process. If not, you can install it with the following command. Assuming you’re using a Mac, and assuming you’ve already installed Homebrew:
brew install git
Git is a command-line tool. This means you work with it by entering text into the command-line (on Mac, this is the Terminal) application.
You use Git by writing various Git commands. Git commands always begin with the word ‘git’. For example:
git add README.txt git commit -m "Added a README file" git push
In the rest of this tutorial we’ll try to develop an understanding of the essential Git commands and how they are used when working with a software project. We’ll begin with an overview of essential concepts in Git, and will then move onto Git’s command-line syntax.
- Essential concepts
- Experiment implementation workflow
- Deleting files
- Ignoring files
- Tagging commits
- Undoing uncommitted changes
- Temporarily visiting a historic commit or tag
- Undoing a historic commit
- Reverting to a historic commit or tag
- Undoing commits accidentally committed to the wrong branch
- Using the Git GUI in your IDE
- Carrying out experimental work on a development branch
- Resolving merge conflicts
- Recap of concepts we covered