The Start of git

Git is a free and open source version control system, originally created by Linus Torvalds in 2005. Comparing with older centralized version control systems such as SVN and CVS, Git is distributed: every developer has the full history of their code repository locally.
Before learning Git, there is something we should know about version control.

What is version control?

Version control systems are a category of software tools that help a software team manage changes to source code over time. Version control software keeps track of every modification to the code in a special kind of database. If a mistake is made, developers can turn back the clock and compare earlier versions of the code to help fix the mistake while minimizing disruption to all team members.

Centralized Version Control Systems
Paste_Image.png

These systems, such as CVS, have a single server that contains all the versioned files, and a number of clients that check out files from that central place. For many years, this has been the standard for version control.
However, If that server goes down for an hour, then during that hour nobody can collaborate at all or save versioned changes to anything they’re working on.

Distributed Version Control Systems
Paste_Image.png

In this system, clients don’t just check out the latest snapshot of the files: they fully mirror the repository. Thus if any server dies, and these systems were collaborating via it, any of the client repositories can be copied back up to the server to restore it. Every clone is really a full backup of all the data.

Git three states

Git has three main states that your files can reside in: committed, modified, and staged. Committed means that the data is safely stored in your local database. Modified means that you have changed the file but have not committed it to your database yet. Staged means that you have marked a modified file in its current version to go into your next commit snapshot.

This leads us to the three main sections of a Git project: the Git directory, the working directory, and the staging area.

Paste_Image.png

The basic Git workflow goes something like this:

  1. You modify files in your working directory.

  2. You stage the files, adding snapshots of them to your staging area.

  3. You do a commit, which takes the files as they are in the staging area and stores that snapshot permanently to your Git directory.

最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容

  • PLEASE READ THE FOLLOWING APPLE DEVELOPER PROGRAM LICENSE...
    念念不忘的阅读 13,541评论 5 6
  • **2014真题Directions:Read the following text. Choose the be...
    又是夜半惊坐起阅读 9,880评论 0 23
  • 来之前特地在网上查阅了该地,西流湖两岸种植的有各种树:松树、垂柳、槐树,参天挺拔,把毒辣辣的阳光挡在外面。人们大多...
    emmmmmm哦阅读 173评论 0 0
  • 以前写的小诗,多是与朋友的交流之作,或是为朋友的摄影作品配文。 天净沙.游秦岭 层峦薄雾烟霞,绿树流水春花,炊烟石...
    明月入怀阅读 166评论 0 0