Git is a version control system for tracking changes in computer files and coordinating work on those files among multiple people. Version Control System (VCS) is a software that helps software developers to work together and maintain a complete history of their work. Git was initially designed and developed by Linus Torvalds for Linux kernel development. It is primarily used for source code management in software development, but it can be used to keep track of changes in any set of files. As a distributed revision control system it is aimed at speed, data integrity, and support for distributed, non-linear workflows.
Git is free software distributed under the terms of the GNU General Public License version 2.
As Git is a distributed version control system, it can be used as a server out of the box. Dedicated Git server software helps, among other features, to add access control, display the contents of a Git repository via the web, and help managing multiple repositories. Remote file store and shell access: A Git repository can be cloned to a shared file system, and accessed by other persons. It can also be accessed via remote shell just by having the Git software installed and allowing a user to log in.
Work Offline With a centralized VCS like Subversion or CVS, you’re stranded if you’re not connected to the central repository. With Git, almost everything is possible simply on your local machine: make a commit, browse your project’s complete history, merge or create branches. Git lets you decide where and when you want to work.
Save time Git uses few seconds per command, but it quickly adds up in your work day. Use your time for something more useful than waiting for your version control system to get back to you.
Undo Mistakes In Git is that there’s a little “undo” command for almost every situation. Correct your last commit because you forgot to include that small change. Revert a whole commit because that feature isn’t necessary, anymore. And when the going gets tough you can even restore “deleted” commits with the Reflog – because, behind the scenes, Git rarely really deletes anything.
Moving or Adding files If you want to move a file inside your repository Git automatically track the moves. This was not possible in old version control applications like CVS. Moving a file would typically require to create a new file and remove the old one, thus losing the changes history.
For example to add only .php files you can run:
$git add '*.php'
Check the Status of Your Changes Check the status of the changes you made to your repository is pretty straightforward. The git status command lets you see what would happen if you committed your changes at a given moment. It can help to avoid the mistakes of using different externals branches of your project.
Branches Sometimes you need to work on new experimental features without interfering with the main code of your project. You can achieve this by creating new branches to try the code of those experimental features. Branches also allow different developers to work on different features without interfering with each other work. Then when the features are ready, they can merge the branch changes in the main branch.