Setting up Java with Git and BitBucket
As of 2014, programming was done using GitHub as a method of pushing and pulling commits, BitBucket as a method of online repository storage, and NetBeans as the IDE. This thorough and conclusive tutorial will also provide complete support for Windows XP to Windows 8 and Mac OS X (tested Mountain Lion and Mavericks). Linux is most likely an option, but most testing has thus far been on Windows and Mac. Future and other operating systems should not be too hard to figure out, either.
Setting Up Software
- Download the latest version of Netbeans. Select Java SE and proceed with download.
- Download GitHub or Git. Windows Mac. Install with default everything.
- Make sure you have the latest version of Java JDK. Mac users have it preinstalled, but Windows users may not. Java JDK from Oracle
- Open up NetBeans
- Go to the Tools Menu and select "Plugins"
- We must now install the FRC Plugins from FIRST. Click on the Settings tab and click the "Add" button. Name it something along the lines of "FRC Java" and paste in the URL "http://first.wpi.edu/FRC/java/netbeans/update/Release/updates.xml" (as of 2014).
- Now click the Available Plugins Tab and select all plugins from the name you wrote in the previous step (e.g. "FRC Java"). Now click "Install".
- Click through the download and click "Continue" when it says something about the plugins being unsigned. Restart the IDE when it suggests so.
- Now check to see if an FRC logo is present in the toolbar. If it is, all is well. Well, not quite.
- If working at home or the computers at school finally have internet access, set up Git in order to push and pull commits in the next section.
Commits are changes or edits to a programming project online. They exist to update a repository, or project, by multiple people, like a Google Drive document, except one must manually "push" his or her changes to the server and "pull" modifications by other people to his or her computer to update it. In 2014, BitBucket was used as the online storage for the program repository so that multiple programmers may edit it.
Windows: Open up "Git Shell" from Windows Start Menu Search or wherever. Not GitHub or Git. We won't be using GitHub, just Git Shell that comes with it. Mac: Mac users will open up Terminal.
First-time users must "clone," or copy the project to the computer. Enter into Git Shell or Terminal:
git clone address of the bitbucket repository, e.g. https://bitbucket.org/PRHS/frc2013_ultimateascent.git -b develop
Upon command completion, the project should now be in some folder on the computer. Default on Windows is in the GitHub folder in the user's Documents. On Mac it is in the user's home folder.
To pull, enter these codes into Git Shell or Terminal:
cd the folder directory of the project on the computer, or drag the folder to this window git pull
If pull ever happens to fail, move to the "Stashing" section of this page.
It is recommended as a rule of thumb to pull before programming to make sure the code on the computer is up to date.
cd the folder directory of the project on the computer; you can also drag the folder to this window git add * git commit -a -m "short comment about what you changed, e.g. fixed bug in autonomous" git push origin develop
When pulling fails, try to execute these commands:
git stash git pull git stash pop
If this does not work, delete the project folder and clone again.