2 Project Management with Git
Many tutorials are available in different formats. Here is a YouTube video ``Git and GitHub for Beginners — Crash Course’’. The video also covers GitHub, a cloud service for Git which provides a cloud back up of your work and makes collaboration with co-workers easy. Similar services are, for example, bitbucket and GitLab.
Here is a collection of online Git exersices that I used for Git training in other courses that I taught.
2.1 Set Up
To set up GitHub (other services like Bitbucket or GitLab are similar), you need to
- Generate an SSH key if you don’t have one already.
- Sign up an GitHub account.
- Add the SSH key to your GitHub account
2.2 Most Frequently Used Git Commands
git clone
git pull
git status
git add
git remove
git commit
git push
2.3 Tips on using Git:
- Use the command line interface instead of the web interface (e.g., upload on GitHub)
- Make frequent small commits instead of rare large commits.
- Make commit messages informative and meaningful.
- Name your files/folders by some reasonable convention.
- Lower cases are better than upper cases.
- No blanks in file/folder names.
- Keep the repo clean by not tracking generated files.
- Creat a
.gitignore
file for better output fromgit status
. - Keep the linewidth of sources to under 80 for better
git diff
view.
2.4 Pull Request
To contribute to an open source project (e.g., our classnotes), use pull requests. Pull requests “let you tell others about changes you’ve pushed to a branch in a repository on GitHub. Once a pull request is opened, you can discuss and review the potential changes with collaborators and add follow-up commits before your changes are merged into the base branch.”
Watch this YouTube video: GitHub pull requests in 100 seconds.