美文网首页
The Start of git

The Start of git

作者: jiadudu | 来源:发表于2016-12-12 18:43 被阅读0次

    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.

    相关文章

      网友评论

          本文标题:The Start of git

          本文链接:https://www.haomeiwen.com/subject/gvdpmttx.html