Thursday, 12 June 2014

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.