Showing posts with label Version Control. Show all posts
Showing posts with label Version Control. Show all posts

Thursday, 12 June 2014

Java EE Web App (part #3)

Versioning Tool #2 (SVN)

Since the complexity needed to understand and operate Git is too high we here try to understand SVN which serves similar purpose as Git. It is used by many heavy weight Tech Companies across the globe.

Assuming there is a VisualSVN server running at developer "x" side which contains the latest up-to-date copy of our project "foobar"

steps needed to copy the latest "foobar" project from developer "x" machine to your machine.

Steps
  1. Download & Install TortiseSVN
  2. Create an empty directory on your desktop named "mynewproj"
  3. Browse in that directory mynewproj and do right click and select TortiseSVN --> Create repository here
  4. It will prompt a dialog box in that dialog box click on "create folder structure" button and then "ok" button
  5. Then again right click and select SVNCheckout, which will bring a dialog box in front of you
  6. In the field named "URL Of The Repository" enter URL which you get from developer "x" which has VisualSVN Server up and running, who also has the fully up-to-date project "foobar" (eg. URL will be like https://IP:port/svn/projectname) after you enter "ok" button a dialog box will pop-up which will ask for username and password, make sure you have one
  7. Then in the "Checkout" text-field select the directory "mynewproj"
  8. Then click on "ok" button, It will bring the latest copy of project "foobar" on your machine
  9. Open Netbeans 8.0, open project from the directory "mynewproj" (in our case it was "foobar")
  10. Perform some modifications ...blah blah...
  11. Now come back again to directory "mynewproj" select the project "foobar" do right click and select "SVN Commit...." it will again ask for username and password, make sure your developer "x" has provided you the same
  12. Once it is done, developer "x" on his machine will have to select the project "foobar" from Netbeans and perform step shown in step 13
  13. Right click on "foobar" project from Netbeans and select Subversion --> Update --> Update with Dependencies
viola !! you have just learned 50% of SVN....congo !!!

For learning how to setup and configure the SVN Server wait for Java EE Web App (part #4)

Java EE Web App (part #2)

Using Versioning Tool In Netbeans 8.0(Versioning Tool #1)

steps


  1. Dowload Git Version Control Tool.
  2. Follow the below screen shot for installing Git.





So, now we have installed Git, now time to use it in our web app created in part #1 of this series.

steps

Start git bash, a command line console will pop-up.

  1. Then navigate to location where you have stored your "MyFirstWebApp" created in part #1 of the tutorial series. (for eg: "C:\Users\Admin\Documents\NetBeansProjects\MyFirstWebApp")
  2. Enter the following lines in git bash
  3. git init
  4. git commit
  5. git add .
  6. Then start Netbeans 8.0 and select Team-->Git-->Connect (if it is not already connected)
  7. If it gets connected you will see image 1.0
  8. If it is not connected you will see image like 1.1
  9. Now if you see image like 1.0 select "MyFirstWebApp" 
  10. Right click and say git-->commit
  11. Enter some message and click on commit button
  12. Now to see if it is working or not ?
  13. Goto index.html file and after a line in body tag keep pressing enter key for 3-4 times you will screen a green color appearing in your IDE as shown in image 1.2
    Image 1.0
     
     Image 1.1

    Image 1.2
Purpose Of Using Git

  1. Suppose there is 3 people (x,y & z) together working on a project called "foobar".
  2. Project "foobar" has a central repository with developer x (or hosted on GitHub.com)
  3. Developer y & z does "Git clone" once to create a local copy of project "foobar"
  4. Developer y & z everyday in morning (or whenever they start developing work) do "git pull" to get all the latest update of the project "foobar" from central repository, Now they will start working on the latest copy of the project
  5. At night (or when they finish developing work) all 3 i.e x, y & z performs "git push" to make changes on the central repository saved at workstation of developer x (or at GitHub.com).

Some usefull commands

  1. Git clone URL:
  2. After you have done a git clone, you have a copy of the complete repository.
  3. Make some changes to the local version of the repository, then git add and git commit the changes to the local repository.
  4. Git push to publish the changes (“commits”) to the remote repository
  5. Periodically git pull to retrieve any new updates from the remote repository.