One important thing most of the git guides ignore is .gitignore (note the name: DOT gitignore). The .gitignore is just a file that lists all the files that git should ignore, that is, should never commit. Mostly these will be files that are auto-generated by your source code (like .class files in Java). Your git repo should not contain any files that are generated by your compiler/ide, except for a few exceptions. The .gitignore file resides on your root directory and is checked into git.
During the next month, I recommend everyone follow the following steps to make sure they can get git+github+gitignore+ide working together well:
- Use a hello-world app you've built.
- Google "your-plaftform gitignore" (for example: "android gitignore" or "asp.net gitignore") to find a a good starting .gitignore file to add to your project. Some nice IDEs now add this file this automatically. If you are on a Mac you will also need to google "mac gitignore" and add those too. There might be more things you need to add. Add the .gitignore file to the root folder of your project.
- Add your app to git using your IDE. Generally, you will want to use the git commands from your IDE.
- On your web browser, go to github.com and create a temporary github repo on your account.
- Push you app to this repo. This will mean setting your IDE for pull/pushing to github.
- Check to see that the files appeared in github. <small celebration/>
- Close your IDE project.
- Clone your github project as a new project, in a different directory. Some IDEs support this (File->Import From Github or somesuch), but for others you will have to "git clone ..." or use the github desktop client.
- Make sure you can compile and run the new project. <small celebration/>
- Make a small change to your source code, compile and run, then git-commit the change and git-push to github.
- Look at your commit in github. It should show only the change you made to the one file. If it says that other files were changed then (likely) those files need to be added to .gitignore. If not, then <large celebration/>
While you are there, also play around with creating a branch from your IDE (name it after your github username), and then switching between this branch and the master branch. Make the two have different code. Compile both.
If you have any problems, drop by my office or setup a time with me or Bridgette.