You are an anonymous user who can't edit RoboWiki.
Log in if you already have an account. If you would like to become an editor for the wiki, request an account.

Setting up Java with Git and BitBucket

From RoboWiki
Jump to navigation Jump to search

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

  1. Download the latest version of Netbeans. Select Java SE and proceed with download.
  2. Download GitHub or Git. Windows Mac. Install with default everything.
  3. Make sure you have the latest version of Java JDK. Mac users have it preinstalled, but Windows users may not. Java JDK from Oracle
  4. Open up NetBeans
  5. Go to the Tools Menu and select "Plugins"
  6. 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).
  7. 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".
  8. Click through the download and click "Continue" when it says something about the plugins being unsigned. Restart the IDE when it suggests so.
  9. Now check to see if an FRC logo is present in the toolbar. If it is, all is well. Well, not quite.
  10. 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.

Set-Up

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.

Pulling

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.

Pushing

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

Stashing

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.

External Links