Creating a Local Git Repository

Load Git Extensions for Windows and select Create New Repository use the browse button to find the folder containing your empty greenfoot project. Click on Initialise

Select Edit Gitignore, and then click on Add Pattern and add *.class *.ctxtand project.greenfoot and then save. This will have the effect of ignoring any class files and java context files which are files created every time the source files are compiled. Also the Greenfoot project file cannot be shared, it is updated automatically as the code is added and modified.

Click on Commit in order to save the changes to the repository. At this stage as none of the files have been commited to the repository you should see your files with a plus symbol next to them indicating that they will be added to the repository. With a new Greenfoot project there will just be two files, gitignore and README.Txt. Select both and click on stage to prepare them prior to commit. Enter a message which should summarise the changes such as Creating initial local repository! and then click on Commit button to execute adding all the staged files to the repository.

When you return to Git Extensions you should see the last commit you have just made. Changes can now be made to the Greenfoot project, for example adding all your Java files from Visual Paradigm. Once these changes have been saved, going back to GitExtensions (which you can leave open) the green commit button should have turned red. That is an indication that changes have been detected, and you can commit them when you are ready. I suggest commiting the changes every so often, based on completing some overall purpose. Commit at least once per session.

In this case I have added all my java classes from Visual Paradigm. Git displays all the changes, with removals highlighted in read, and additions highlighted in green. The changes can then be commited to the local repository.

Back in Git you can see all the different commits you have made, and how long ago you made them. I will examine this record when I am marking your work, as it is evidence of how much work each student in the team has contributed. I can also see exactly what changes each person has made over time.