Setting up Git for this Course
I give you freedom in this course to set up your GitHub repository how you see fit. I do, however, recommend that you use GitHub (or at least Git as a way to version control your code).
One way to organize your work in this class is to make a single top-level repository and then put individual assignment and project repositories below it. Here is an example of how the sample solutions repository looks (after posting the day 4 solution).
├── Class01 (note: this is a project)
│ ├── .idea
│ │ ├── .gitignore
│ │ ├── encodings.xml
│ │ ├── kotlinc.xml
│ │ ├── misc.xml
│ │ └── vcs.xml
│ ├── src
│ │ ├── main
│ │ │ └── kotlin
│ │ │ └── Main.kt
│ │ └── test
│ │ └── kotlin
│ │ └── FindPeakTest.kt
│ ├── .gitignore
│ └── pom.xml
├── Class04 (note: this is a project, separate from Class01)
│ ├── .idea
│ │ ├── .gitignore
│ │ ├── encodings.xml
│ │ ├── kotlinc.xml
│ │ ├── misc.xml
│ │ └── vcs.xml
│ ├── src
│ │ ├── main
│ │ │ └── kotlin
│ │ │ ├── Main.kt
│ │ │ └── Stack.kt
│ │ └── test
│ │ └── kotlin
│ │ └── MyStackTest.kt
│ ├── .gitignore
│ └── pom.xml
├── Class04Optional (note: this is a project, separate from Class04)
│ ├── .idea
│ │ ├── .gitignore
│ │ ├── encodings.xml
│ │ ├── kotlinc.xml
│ │ ├── misc.xml
│ │ └── vcs.xml
│ ├── src
│ │ └── main
│ │ └── kotlin
│ │ ├── Main.kt
│ │ └── MutableStringList.kt
│ ├── .gitignore
│ └── pom.xml
Steps to Achieve the Setup Above
- Make sure you have git set up properly on your computer (meaning you can run git at a terminal, and it responds with some output)
- Make sure you can clone your repos from GitHub with write permissions (e.g., by adding an ssh key to your account and to your machine)
- Create a repo on GitHub for your class work. You can initialize it with a README file.
- Clone your repo on your machine with write access (e.g., using ssh).
- When you create a new project, select the directory for your cloned repo as the root and give the project a name (this will become a subdirectory inside your repository). Make sure you uncheck the
Create Git Repositorycheckbox (since the git repository is already associated with teh top-level directory) - Use git add, git commit, and git push as normal (these can also be done through the IntelliJ user interface).