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.

Difference between revisions of "Setting up Java with Git and BitBucket"

From RoboWiki
Jump to navigation Jump to search
 
(12 intermediate revisions by the same user not shown)
Line 1: Line 1:
{{stub}}
+
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.
 
 
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 up to Mountain Lion 10.8.3. 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==
 
==Setting Up Software==
 
#Download the latest version of [https://netbeans.org/downloads/ Netbeans]. Select Java SE and proceed with download.
 
#Download the latest version of [https://netbeans.org/downloads/ Netbeans]. Select Java SE and proceed with download.
#Download GitHub, ''not'' Git. [http://windows.github.com/ Windows] [http://mac.github.com/ Mac]. Install with default everything.
+
#Download GitHub or Git. [http://windows.github.com/ Windows] [http://mac.github.com/ 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. [http://www.oracle.com/technetwork/java/javase/downloads/index.html Java JDK from Oracle]
 
#Make sure you have the latest version of Java JDK. Mac users have it preinstalled, but Windows users may not. [http://www.oracle.com/technetwork/java/javase/downloads/index.html Java JDK from Oracle]
 
#Open up NetBeans
 
#Open up NetBeans
Line 12: Line 10:
 
#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".
 
#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.
 
#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, you did it right.
+
#Now check to see if an FRC logo is present in the toolbar. If it is, all is well. Well, not quite.
#If you are working at home or the computers at school finally have internet access, we must set up Git to let you push and pull commits. Move to the next section.
+
#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==
 
==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 you must manually "push" your changes to the server and "pull" modifications by other people to your computer to update it. We are using in [[2014]] BitBucket as the online storage for the program repository so multiple programmers may edit it.
+
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. We won't be using GitHub, just Git Shell that comes with 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.
 
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:
 
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
 
  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 folder...? On Mac it should be the user's home folder.
+
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==
 
==Pulling==
To pull, you must enter these codes into Git Shell or Terminal:
+
To pull, enter these codes into Git Shell or Terminal:
  
  cd ''the folder directory of the project on the computer; you can also drag the folder to this window''
+
  cd ''the folder directory of the project on the computer, or drag the folder to this window''
 
  git pull
 
  git pull
  
If pull ever happens to fail, move to the [[Setting up Java with Git and BitBucket#Stashing|Stashing]] section of this page.
+
If pull ever happens to fail, move to the "Stashing" section of this page.
  
We recommend pulling every time you begin programming to make sure your code is up to date.
+
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==
 
==Pushing==
Line 42: Line 40:
  
 
==Stashing==
 
==Stashing==
When pulling fails, try to execute the stash commands:
+
When pulling fails, try to execute these commands:
  
 
  git stash
 
  git stash
Line 48: Line 46:
 
  git stash pop
 
  git stash pop
  
If this does not work, delete your project folder and clone again.
+
If this does not work, delete the project folder and clone again.
 +
 
 +
==External Links==
 +
*[http://first.wpi.edu/Images/CMS/First/Getting_Started_with_Java_for_FRC.pdf Java for FRC Guide]

Latest revision as of 19:52, 21 March 2014

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