Getting started
Git is a popular version control system that allows you to save and access histories of files. Git is great for tracking & testing multiple versions of code and for collaborative coding.
Last updated
Git is a popular version control system that allows you to save and access histories of files. Git is great for tracking & testing multiple versions of code and for collaborative coding.
Last updated
Follow the directions here to install git:
Git lets you use branches to test new features/code while keeping a clean record on the main master branch. This functionality is great: if the experimental feature is unsuccessful, it doesn't effect the copy on the master branch; otherwise, if successful, it can be merged back into the master branch.
To create a local git repository, run git init
in the desired directory. To add or update files in the local repo, first use git add <filename>
to add individual files or git add .
to add all files (excluding those in .gitignore). This moves the updated files into the staging area and you can check the status using git status
. Then, commit these changes to the local repo using git commit -m <message>
and you can check commit history with git log
.
To collaborate, you would want to set up a remote repository on GitHub. To update the files on the remote repo, use git push
. To update your local repo (e.g. when a collaborator has edited something in the remote repo), use git pull
. Be sure to use git pull
before git push
, and if there is a conflict, you may need to merge the code before pushing onto the remote repo.
List the directories and files (e.g. big data files, private info/keys, virtual environment directory, etc.) that you don't want to track with git in a file named .gitignore.
GitHub is really popular for hosting remote Git repositories. Create an account on GitHub: