Git allows a team of people to work together, all using the same files, and it helps the team to cope up with the confusion that tends to happen when multiple people are editing the same files.
There are many ways in which it can be set up and configured and for an example, when a new employee starts, he downloads all the files from Github, which is an online server, all the team members are connected to. So he has his local version of the files, his team-mates have their local versions and even the boss has her/his local version, etc.
When a change to some files has to be made, one has go through the following process in the Terminal. (There are GUI clients for Git but many prefer working on the command line.)
> git pull
That pulls the latest changes down from GitHub. If there are conflicts between those and the local ones, it can tell what they are, file-by-file, line-by-line, and now, even there we have a chance to reconcile those differences.
After editing the files, lets run this command:
> git add .
This adds all of the local changes to git so that git knows about them. The dot after add specifically means to add all the changes one has made, e.g. the new files that have been added to the local folder or changes he/she has made to existing files.
Finally, we upload our changes to the server.
> git push
So now, when the colleagues do something like the follows
> git pull
... they will get the changes, and they will be notified if any of them conflict with their local versions.
.
Comments