4

Possible Duplicate:
What is a version control system? How is Git useful?

We have a PHP project we use NetBeans IDE and i think it rocks.

We do all the work online (because of some database compatibility issues on user computers and servers).

Once we save a php file in netbeans it automatically uploads the file to the server (because when we save a file we want to test it and testing a file needs it to be online).

The problem is that we are a team and we use zend framework's MVC so there are many times that we are working on a same controller(file). (but different actions).

There were times that we accidentally deleted each other codes when we uploaded the outdated local files with OUR new changes (not the other people new changes) while we have taught each other to download every file before editing, we are just humans and (unlike computers) make mistakes.

It is so hard to find where the mistake happens and if the mistake has happened. because every one tests only his/her own code after uploading it, not all the code. and problems are just detected like "where the hell did that problem come from, i had checked that shit"

I figured out that we are not the 1st team in the planet with this type of issue and after a HUGE search i finished with the 3 letter word solution GIT.

But while i am studying git it seems to be just a back up of files of different edits, while it is useful i don't know if it can help with multiple persons working on ONE file.

Does git help that way?

Community
  • 1
  • 1
shampoo
  • 1,173
  • 12
  • 22
  • 1
    "we want to test it and testing a file needs it to be online" Thats.just.scary... – KingCrunch Aug 02 '12 at 10:00
  • it's not on the internet, it's on one of our local network computers, online means on our local network's line. – shampoo Aug 02 '12 at 10:03
  • 1
    Yes, a *version control system*, ***any*** version control system, is an absolute necessity when coding in a team. Heck, it's necessary for just coding alone. And it's more than "just a backup". Learn it, use it. Learn it by using it. – deceze Aug 02 '12 at 10:03
  • after about a weekend learning GIT, now i feel living in heaven ... it really was an essence and is. – shampoo Aug 22 '12 at 13:36

2 Answers2

3

Git will help you in situation when many developers are editing one file. It will perform fully automatic (no merge conflicts) if they edit separate parts of file and will require some manual interaction (resolve merge conflicts) in case if someone edited the same part.

Sergey K.
  • 24,894
  • 13
  • 106
  • 174
1

You should configure Netbeans and git that on commit, you push to the remote host which is the server. That done, you can better edit together the same files while you also use git to keep the code on the (development and life) server up to date while working collaboratively.

This can be done with pre- and post- commit hooks. On the server you can run a so called bare repository.

On merge conflicts, the server can refuse to accept your changes, so you need to resolve merge conflicts on your box first before pushing that onto the development version.

You then can always push from the development version to the staging or life server. When you use tagging, you even have software versions that you can publish on click.

Git is very helpful here to do that thanks to it's ease of installation, power of use and it's de-central nature. Nothing has influenced how I write and publish software that much than git in the past years.

hakre
  • 193,403
  • 52
  • 435
  • 836