B
B
beginer1232016-07-24 00:17:07
git
beginer123, 2016-07-24 00:17:07

How to use GIT correctly?

Hello, I’m just starting to write websites, we are the 3rd person who wants to write a simple business card website (in order to learn how to do everything right)
To do this, we bought a VPS with ubuntu. put apache, php, mysql there
We have only basic knowledge of php, html, css, js
Never worked with git
I want to immediately start doing it right
Actually, I understand correctly we need:
1) Everyone on their computer (we have Windows) puts the same the same as on VPS - php, mysql, apache
Here everyone will have a test version of the site
2) Everyone puts git on his computer
3) ???
4)???
Is it necessary to install git on a VPS Server?
Does GIT take into account changes in MySql? If someone adds a new table
Do I need github? Or other similar sites
How do I organize all this?
I didn’t really find examples of use from scratch on combat projects on the Internet.
Usually they just install git and show how it works on txt files.
That is, you can have some step-by-step instructions, like
put each one on your own ...
on github you will have it. ...
And in 2 words describe how we can jointly organize the work

Answer the question

In order to leave comments, you need to log in

6 answer(s)
X
xfg, 2016-07-24
@beginer123

Github Flow in 5 minutes.
1. Created a branch for the feature/fix
2. Made several commits to the branch
3. Sent a pull request
4. Discussed the pull request with colleagues and made changes if necessary
5. Run the branch through tests.
6. Poured into master
7. Rolled out master to production
If the feature branch does not merge for a long time and starts to diverge from the master branch, then merge master into the feature branch and continue.
If someone from the team wants to test a new feature with their hands, they can do
AND test it with their hands locally on their dev machine.
Update: If sql base, then write migrations. You can see in any framework what it is and how to use it. After each git pull, we try to roll the migrations through the console (you can write a hook for the git) and if there are new migrations, they will be applied to the local database. If the nosql database is of type mongo, then nothing is needed, they are schemaless.
On production, we pull the code from the git into a separate directory. We apply migrations to the database, then switch the symlink from the directory with the old version of the project to the directory with the new version of the project. If migrations break the old version of the project, then you must first turn off the project so that users do not get any uncaught exceptions. This is in short, for all this you need to pick up a ready-made deployment tool for yourself, which will automatically do all this.

D
Dmitry Entelis, 2016-07-24
@DmitriyEntelis

I strongly advise you to read https://git-scm.com/book/en/v2

S
Sergey, 2016-07-24
@gangstarcj

In short (I can make mistakes in some points)
1) Everyone puts what is convenient for him (denwer, xampp, openserver (I recommend openserver under Windows))
2) Put each git
3) You fight on bitbucket. You join the beatbucket, create a team, while the three of you will be there for free. You create an empty project there
4) You create a project on the VPS (it usually already has a git on it)
5) you do init git on the VPS and push it to the project on the bitbucket
6) You merge files from the server to each and everyone makes a clone of the turnip from the git 7) Work
, make commits, write to bitbucket.
8) Then shoot from bitbucket to VPS

S
Stanislav Makarov, 2016-07-24
@Nipheris

Is it necessary to install git on a VPS Server?

Not necessarily, it depends on which access option you choose - via SSH, via HTTP, or even install some kind of Gitlab or Stash (only here it depends on the capacity of your VPS, not the fact that it's enough). Google the installation instructions (git over ssh, git over http) and see what you need on the server.
Git is not directly related to relational DBMS, and it cannot directly take into account changes in the database in principle. Git works with files and the file system, in fact it is a multi-versioned file system on top of a regular file system, with branching versioning. For branching versioning directly in the database, there are currently no common solutions (there are a couple of implementations, but you don't want to deal with them). Therefore, developers solve the problem of versioning and updating data and schema using special scripts - "migrations", which are stored in ordinary text files in Git. These can be both ordinary SQL scripts and scripts for a specific framework/library for working with a database. When developing a project, every time it is necessary to change the schema or initial data in the database, a migration is written, which updates the schema or data in the database when the project is deployed. Google "PHP migrations" and you'll find out.
You decide. If you have a VPS and are ready to set up Git for collaboration there, then you do not need a github. If you do not want to take a steam bath, and it is easier for you to pay for a private turnip - please. If you do not need the privacy of the repository, you can create an organization on github right now and use it.
There are many aspects, ask specific questions. In a nutshell, you can’t tell about the establishment of a web studio.
Use of what? Git? What remains unclear to you?
1. Install the Git client on workstations.
2. Set up access to the shared repository on the server.
3. Collaboration is organized by choosing an existing one or developing your own methodology for versioning the project and branching the state of the repository. Git Flow is generally recommended as a fairly simple and versatile model to start with. Once you understand what Git really is, you will understand what you need from it and how to get it (and work out this model yourself).
In any case, one way or another, it all comes down to branching / merging branches, and how exactly to do this - see above. Git only provides the concept of branching and the concept of local/remote branches, i.e. decentralized repository.

V
Vladimir Grabko, 2016-07-24
@VGrabko

For all questions about Git, the answer is one: git flow

A
Alex, 2016-07-24
@apletnev

Since the purpose of learning is:
1. disconnect from the VPS;
2. set up the environment through VM - docker (it's better to learn right away);
3. commit the project structure with dockerfile (dockercompose) either in bitbucket or github;
4. comrades fork the project and make pull requests;
5. if the site is made, and you need to show it to someone, then only buy a VPS.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question