A
A
Alexander2013-06-16 01:07:04
PHP
Alexander, 2013-06-16 01:07:04

Who can explain why I need GIT?

What is GIT I superficially got acquainted. I also read about SVN, I heard it many times before, but I never used them, as I didn’t have to.

I am working on a php project that is on my server, accessed via FTP. I use Netbeans as an IDE. Every time I sit down at the next PC, I download php files from the ftp server in Netbeans in order to continue working, making changes, and so on ...

Actually, the question is: I can’t understand what the distributed version system will give me, except for the ability to roll back to the previous version of the file being edited (this is convenient and good, everything is clear with this)? What about the rest? So what are the benefits of using it?

In the current cases, when saving in the IDE, the file is ftp-uploaded to the server - you can immediately check what I coded (isn't that convenient?). And if you use GIT (from what I read), all fixes need to be checked locally. Well, if this is the case, then what about the same MySql database? In addition to MySql on the hosting, keep MySql server locally? And if I changed the structure of the table, entered the data, what about the synchronization of the local version of the database and on the server with the production version?

I suspect that my questions are primitive, please do not kick much. I want to use Git, I heard a lot of positive feedback about convenience and so on, but I really don’t understand what the point is

Answer the question

In order to leave comments, you need to log in

10 answer(s)
N
Nikita Gusakov, 2013-06-16
@hell0w0rd

The bottom line is that you can clearly control at what point it turned out badly. You can trace the chain of events that led to this. And most importantly - you can safely roll back to the moment when everything was fine.
In the case of git and ssh access, you do this, on the local machine
git push
on the server
git pull
And that's all!
If you are working with a composer, then you can, for example, set it composer upto run git pullbefore updating dependencies. Thus, you bring the entire project up to date with one command.
And yes, for good, you should have a separate database in which test data is stored, because table schemas are important to you, and not their content during development?
Also about the git - imagine that you love women so much that you want to date several at the same time. In reality, it is difficult to hold more than n-count in parallel, they will collide and you will feel bad. And in git you just create branches and then they do not imply merge procedures about each other. Ideally, each feature of your application should be created as a separate branch (branch), so you can view the development history of that particular feature separately.
It's chaotic, but this is the feeling after using the gita for half a year.
PS also imagine that you are now probably working alone, but what is it like to work in this way in a team. If this is done without VCS, there is a high possibility of overwriting the file that has just been changed, etc., etc.

M
Maxim Dyachenko, 2013-06-16
@Mendel

History management. Netbins likes to lose history, it makes no sense to really rely on it. And here is the base.
Branching and merging. When you need to make a big change, and the system is already in production, and you have to maintain it, then make a branch, and edit on it, and then merge the branches, so as not to overwrite changes in both - it is almost impossible when there is no version control system.
Collaboration. Any nonsense like writing in ICQ disappears, they say, don’t touch such and such a file, I edit it ...
Hundreds of small commits with descriptions. Those. you make changes, and immediately describe, and you can immediately see in which files it was and when ... Helps in investigations, in documentation.
The ability to control “what has changed”. An anecdotal case - I somehow decided at four o'clock in the morning to rename the desc field in one model class to _text. It appeared in several hundred classes, so I used find and replace. Semi-manual.
A month later, I got a glitch with data sorting. It turns out that when searching, I accidentally replaced desc in requests in the ORM. If GIT had been better then the test coverage would not have had to look for the cause for two hours. I would see that I have a change in such and such a file, but it is inappropriate there ...
There can be many reasons. But perhaps your volumes of complexity simply do not require you to make such decisions yet.

S
Semyon Dubina, 2013-06-16
@sam002

Git is a tool with a certain functionality and nothing more. The ways to use it are limited by your imagination. It becomes necessary and indispensable when working in a team.
Examples of use in one:
1) Work with a remote server in the same way (netbeans allows this), split your project into a couple of versions - dev and production, initialize in the dev repository, work with the version in dev, and at the end of the work stage, make a commit ( saving developments in git) and upload it to production.
2) locally make a copy of the git repository, connect to the database remotely, then combine several developments from different copies (from your home machine and working, laptop ...) into one project, automatically or manually resolving conflicts.
3) Well, the ability to quickly roll back to a specific version is priceless! By the way, each copy of the repository will have a complete history of changes.

R
rsvasilyev, 2013-06-16
@rsvasilyev

in the IDE, an ftp-upload of the file is performed on the server - you can immediately check what I coded

I hope that the server in question is some kind of dev version of the site, and not a live one. Moreover, on a live server, error display should be disabled. Not all projects can be uploaded to a live server just like that by pressing Ctrl+S. No one is immune from stupid mistakes, and it will be very frustrating if site visitors see a fatal error.
If you set up LAMP and your project on a working computer, development becomes an order of magnitude more enjoyable. After an error, you can safely start looking for its causes, and not feverishly press Ctrl + Z.
Specifically for git, there is a cool git-ftp extension that uploads only changed files to the server. Well, if you have access via SSH, then everything becomes even easier.
As for MySQL, yes, the version control system cannot update the database schema itself. To do this, good frameworks provide migrations, which can also be rolled back at any time. But even there is no such possibility, it is better to first make changes on the local version, and only then transfer to the live one.

E
egorinsk, 2013-06-16
@egorinsk

Git is needed primarily for team development. Or if you want to put the project in open source on github so that you can view the code online and send bugs and patches without downloading and unpacking zip archives. If you are the only one doing a simple project, then you can do without it. If a second person appears, then you cannot do without CVS.
> I'm working on a php-project, which is on my server, access to which is via FTP protocol
. It's inconvenient, brakes, Ide slows down, synchronization slows down, everything slows down. Why live like this?
> And if you use GIT (from what I read), all fixes need to be checked locally.
In theory, no one can write a script to deploy changes to the server, but it will be inconvenient and longer than directly. These scripts are usually crooked and can, for example, load all files in a row, and not just modified ones.

K
kreativf, 2013-06-16
@kreativf

First, it must be said that the file versioning system is in no way a replacement for the development / testing environment (in terms of a web server or database), it is just an additional tool. First of all, the versioning system will give access to the commented history of changes. This can come in handy, for example, when you are looking for a bug that you contributed while fixing other bugs. Versioning also helps if you have not been involved in this project for some time - it is easier to remember where you left off. It will also become easier to develop the project, regardless of the version of your code on the “combat” server (for example, make live and development branches). FTP upload is not a hindrance to versioning, they are completely different things. The database can be versioned separately, but typically only the core structure of the database is versioned for a greenfield deployment (e.g. . php file with create statements). SVN or Git (or another CVS) is more of a choice according to the taste / need of the goodies. Of course, any CVS will be needed if someone other than you suddenly starts working on the project.

P
Puma Thailand, 2013-06-16
@opium

The main essence of these systems is version control and history, how do you know what you changed on March 12, 2009? or how to find out if this file has changed since the beginning of the project? and then mergers and kickbacks.

Y
yuriykulikov, 2013-06-16
@yuriykulikov

Good afternoon! Git will give you the ability to track history, simplify code review, give you the ability to rollback individual changes (git revert) and also make it easier to find changes that made a regression (git bisect). Usually those who already know how to use it use it even for every little thing. Look here nvie.com/posts/a-successful-git-branching-model

I
Informatik, 2013-10-22
@Informatik

What is version control system

D
Dmitry, 2016-07-11
@Itachi261092

To be honest, I didn’t read all the answers, but the first ones on the list definitely didn’t have the most important thing - the git is needed first of all by the development teams! If you are coding alone and the project is not very cumbersome, you can get by with a local history of changes (in PHPStorm it works fine), if everything suits you.
Although after I started using it, I will never switch back to non-versionless development even if I code something alone. it's too convenient - line-by-line comparison of changes, saving the entire history, remote storage. charm!

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question