Using Git for Your Arcade Game Project
For the arcade game project, you will be doing group development. Therefore, we’ll be asking you to use a source control system called git. You’ve already used git to checkout code/homework from the CSSE220 repo, but for this project you will be managing a repo and also using it to submit your homework.
Step 1: Forking My Repo
This step should only be done by one member of your Arcade Game team.
Go to this URL:
https://ada.csse.rose-hulman.edu/hewner/ArcadeGame
You’ll have to login with your rose credentials.
- Click “fork”
- Select your name as the namespace
- Go to Settings > General > Permissions
- Change the Project Visibility to “Private” and press “Save Changes”
- Go to Settings > Members
- Invite the other members of your team to your project (they may need to login at https://ada.csse.rose-hulman.edu/hewner/ so they show up in the list) as Maintainers
- Invite the other members of the grading team to your project as Maintainers. The team should be
- Michael Hewner
- Joseph Hollingsworth
- Nicklas Carpenter
- Knut Peterson
- Jordan Hazelrigg
- Ryan Bailey
Find your repo URL. It should appear beneath your project’s name on the main project page. It should look something like this:
https://ada.csse.rose-hulman.edu/XXXXXX/ArcadeGame.git
Go to this spreadsheet and set the URL for your team
https://docs.google.com/spreadsheets/d/13sddHs4ibMhEezSFs-IjkCt71TvmWy19bqk98kSavkw/edit?usp=sharing
Step 2: Checking out the Repo
This step should be done by everyone in your team.
- In your browser, go to https://ada.csse.rose-hulman.edu and verify that you have access to your project. Copy the Repo URL.
- Open your Eclipse and go to File > Import > Git > Projects from Git
- Select “Clone URI”
- In the URI field paste the URL you took from the website. Host and repository path should get filled out for you
- In Authentication, enter your rose credentials (you might find it convenient to have it save these for you) and hit Next
- In branch selection make sure master is checked and click next
- In local destination, you can configure anywhere you like except the directories that your existing CSSE220 repos are being checked out to
- Select “Import existing eclipse projects” and select next.
- You should see “AracadeGameGit” on the list, make sure it’s checked and select next
- You should see a folder for ArcadeGameGit in your project browser
Step 3: Test Push and Pull
Have one member of your team make a change and push it. Here’s how:
- In eclipse, edit the Main.java file (maybe edit the @author? whatever) and save it
- Right click on the project folder and select Team > Commit
- Verify that main.java appears in your list of “Staged Changes”
- Also add the .gitignore to your staged changes by selecting it and clicking +
- Add some text in the commit message
- Select Commit and push
Have everyone else on your team pull the latest version
- Right click on the project folder and select Team > Pull
- You might have to enter your credentials
- You should get the updated files
Step 4: Cause a Merge Conflict
Have everyone in your team
- Edit the same line of code in a different way. Say add your name to the println.
- Attempt to commit and push.
- The first person who does it should succeed. The rest should get a “rejected non-fast-forward” error.
For one of those those who failed:
- Right click on the project folder and select team > Pull
- You should see a message about conflict and things will look sort of scary
- Look at the edited file. You should see that both versions of the code are there plus some <<<<< ===== >>>> lines
- Figure out what the combination of the changes ought to be (probably all your names in the println) and edit the file to be correct, deleting all unnecessary stuff
- Test your code and make sure that everything works as expected
- Write click on the project folder and select Team > Commit
- Manually move all your files into “Staged changes” with the +
- Commit and push
- Now have the original committer pull and they should have the merged version too
- If they are any other members of year team, have them do step 4 onward
Step 5: Let’s do this
You have the basics!
- Have the team member who has the latest version of your source code copy all the files into ArcadeGameGit (hint: you can select files in the eclipse package explored and use right click copy and paste)
- Test and verify that the game runs in its new project
- Stage all the files, and then commit and push them
- Have everyone else pull the changes
- Verify that everyone has a running up to date game on their eclipse
Done!
Good Advice for Minimal Merge Conflicts
- Pair program whenever possible
- Always do a Team Pull before you begin programming
- Always to a Team Commit/Push when you finish
- If you do have to resolve a merge conflict, remember you must accommodate both changes