

git commit -m "First commit in my Practice01 repository" You haven't committed yet - this step is called "staging" and lets you review before completing the commit. (Seeing a pattern? git status is our eyes, letting us visualize what's currently going on in the repository.) All the untracked files now show up under "Changes to be committed". Add all the files in this folder with the following command: git add. Now we're going to make the first commit to this repository. You'll still see untracked files, but the ignored ones aren't listed anymore. These files DO belong in version control, especially as your projects grow and become more complex, so we aren't ignoring them. This contains IntelliJ settings for your project. class files are compiled binaries, which are generated freshly every time you Run your code, so there's no reason to store them, either.Īnother hidden folder you may have noticed is. This is irrelevant to IntelliJ or your Java code, so it has no place in your repository.

#INTELLIJ GIT ADD REMOTE REPOSITORY MAC#
DS_Store is a hidden Mac file that contains settings for each folder, like how icons are positioned.

Type the following lines into it.DS_Store Create this file in the root of your new project folder: touch. gitignore, Git will avoid adding to your repository and won't show as untracked files. It is important for keeping your repository organized. It is "hidden" (files beginning with a period are not shown in Finder windows, but you can list them from Terminal using ls -a). gitignore is a file that Git understands. If you ran your code, you will also see an out/ directory and a.
#INTELLIJ GIT ADD REMOTE REPOSITORY CODE#
You should see a list of "untracked files", including IntelliJ's project structure, and your code files. Use cd to navigate into the IntelliJ project your just created: cd ~/Desktop/Practice01. Initialize Git within your project folder. Git doesn't care if your code works, but it's good practice to only commit functional code. You can run your code if you like, to ensure that it compiles. Just copy and paste the contents of one of your Java exercises into the new file. The contents of this file aren't important, but we want to practice adding files to your repository.

In the Project Structure panel, right-click on the src folder and create a new Java Class. The "root" folder of this project will therefore be /Users/yourname/Desktop/Practice01, or using the ~ "home" shortcut, ~/Desktop/Practice01. Name it Practice01, Practice02, and so on, as you repeat this exercise. Create a new IntelliJ project.įirst, open IntelliJ and create a new project on your desktop. You don't have to memorize each command - that's what cheat sheets are for! - but rather, focus on understanding their relationships to the files on your computer, your development environment (IntelliJ), and GitHub. Repeat this exercise a few times, until you're comfortable. Even if you are comfortable with your Git workflow, you should go through this and understand what is happening - and more specifically, where on your computer's hard drive and on GitHub it is happening. This exercise is a straightforward recipe for starting a new IntelliJ project, adding a code file, and marrying a local Git repository to a remote GitHub repository. For the things we have to learn before we can do them,
