How to Use git to make git a powerful tool for personal work backup (it is recommended that you learn it even if it is a computer)

Source: Internet
Author: User
Tags add time how to use git version control system
    • Version Branch
    • Start work

Do not use this article as a technical article for programmers. Even if you do not know anything about programming, you can follow the instructions in this article to learn how to do it. More importantly, this article will show you how to make git your job log, your backup tool, and your project management software. That's right. Git makes everything so simple.


OK. What is git? Wikipedia ( (software) told us:"Git(/BytesBytesT/) IsDistributed Revision ControlSystem with an emphasis on speed. "This is a distributed version control system. It sounds so domineering. Who developed it? This name is even more domineering, Linus Torvalds-father of Linux.

What is a version control system?

Let's give an example. For example, you have to write a business plan book. After several days of staying up late, you finally wrote a first draft proposal.doc on. After two days of fighting, you made a more in-depth refinement of the previous documents, so the previous file was renamed as a proposal-2012-01-01.doc as a backup. Later, after intense discussions with your boss and repeated revisions to the document, you finally handed the 7th version to the boss on. Look back at the current jobCompositionFolder, oh, full of name: proposal-2012-01-01.doc,proposal-2012-01-03.doc... Proposal-2012-01-09.doc file. You are not willing to delete them. You can compress them into your archive folder and may never read them. Even if you want to refer to them in half a year, you can also check the latest versions of files at most. The relationships between those historical versions may never be remembered.

This is a common example. Anyone who writes a report on a computer will have this experience. When saving a modified file, we are used to adding a date (or other methods you are interested in) for the earlier version as a backup, for fear that we will not be satisfied with a later modification and will recover it; if you have obsessive-compulsive disorder, you may wish to write a row of backup once. If you have learned git, I am afraid this obsessive-compulsive disorder will become more intense, because it is so easy to use. This is a simple version control system. You manually add time tags to a file and save some milestones for editing so that you can view, back up, and restore the file in the future.

Since we have such a general and strong demand, version control system software is naturally receiving attention and constantly updated and upgraded. From CVS to SVN to git, the management mode of the version control system has evolved from centralized to distributed. The distributed feature of git is that, although we can have a core central server to manage all the files, you can generate a local version control system in git, you can save your version history locally until you get a satisfactory version and then submit it to the server. For individuals, it is enough to even ignore the existence of a central server and control the version of the standalone version. The purpose of this article is to teach you how to change the standalone version of git.


To do well, you must first sharpen your tools. We need very few software, only two, tortoisegit ( and msysgit (, the former is with Windows Explorer (Linux and Mac users borrow a bit) integrated git management software, which is a functional software of git.

After tortoisegit is installed, restart the computer and right-click these newProgramGit-related functions can be accessed from here, and the Start menu is not required. Is it very convenient?

(SVN is another software, please ignore it)

Select setting. We need to configure the GIT path.

In the red box, we want to set the GIT path, that is, the bin folder where you install msysgit, for example, my is F: \ Software \ develop \ SVN \ git \ PortableGit-1.7.8-preview20111206 \ bin, there will be the git.exe program.

In this case, our environment has been configured, isn't it very simple?

Practice Basic knowledge

Next, let's take a look at how git becomes the cutting edge of our backup.

Create a blank folder as a practical platform.

Right-click the folder and select "Git create repository here...". The pop-up dialog box is left empty. Do not select the check box and click OK. This folder contains a hidden. Git folder. How to hide a folder? Put the dog in the search box.

OK. A version library is created. Go to the upper-level directory, and you may see a green check mark added to the file, indicating that the folder has been controlled by the version. (This icon may not appear in real time. You may need to refresh it several times or even restart your computer)

Common icons are:

This file (folder) is very clean and is the latest version.

This file (folder) has been modified and needs to be submitted

This file (folder) needs to be added to the version Library

This file (folder) is not in the version library and needs to be added (to the status of the previous icon) or ignored (to the status of the next icon)

This file (folder) is ignored and is not subject to version control.

The contents in this file (folder) are conflicted (this is the most dangerous situation, but for individual users, there is almost no conflict, the situation is that two people modify a file at the same time, if the submitted person cannot integrate with the former when updating the content, this does not need to be understood in depth)

With this intuitive icon, you can now get familiar with your work folders. If you modify those files, you can see whether the current work needs to be submitted.


Version Branch

When performing further operations, it is necessary to understand the concept of the version branch. The version branch means that you get a copy from the current project and modify it randomly according to your own ideas. All your later version history will be saved in this branch. If you are satisfied with this branch, you can merge it into the original primary branch (merge), or even directly use this branch as the primary branch; or you may feel that the worse the change, you can directly return to the master branch to work, as if nothing had happened (of course, this new branch should be deleted through some complicated operations, you can also keep it as a warning for your own lessons ). That is to say, the Branch provides you with a space to try some new roads.

As an individual user, it is enough to have a master Branch and a work branch. The master Branch remains unchanged as the benchmark, and the work is carried out on the Work Branch. The changes between the master Branch and the Work Branch record all your work history.

Let's take a look at it.

First, git has a "bug" that is not user-friendly and cannot add blank folders. Therefore, we need to add a blank file, such as test.txt, and then right-click the folder and select "Git commit"

Select the file to be added and write a message (each git commit must write some text to describe the content of this update, so that you can know the changes in each version) to submit.


Right-click the work file and select "create branch".


Just name it like develop and click OK.

Right-click "show log" and the following dialog box is displayed.

We can see that we have a version history, which records our changes in detail. There are two color labels, the red master and the green develop, which represent our branch. The master is the branch automatically generated by the system when we submit the job for the first time; the develop is created manually. Red indicates the current work branch, and Green indicates the existing historical branch. We need to switch the Work Branch to develop.

Right-click the folder and select "switch/Checkout", select "develop" in branch, and check the history. Then we will find that "develop" turns red.

Start work

Next, we can do what we want. Edit example test.txt, create a folder, and add Word and Excel files. You will see that the modified file has a red exclamation mark, and the newly added version control file has a blue question mark. For the blue question mark, you can choose "add" in the right-click to turn it into a blue plus sign (or sometimes it turns green in one step, which is not important), or ignore it.

Then on the root file, select Commit and check the history to find your work record.

There is a problem when you enter the user name in commit. This is not important at all. You just need to enter the user name and email address.

It can be found that develop has improved a version, and the master is still in the original position. In the History display, test.txt is modified, and a word or Excel file is added. Folder Information is not recorded.

Double-click the test.txt file and it will show you what changes have taken place in this file. Even the changes in Excel and Word will give you the appropriate method for comparison.



Shocking! Yes, git will keep 1.1 drops of records faithfully. As long as you commit, the system will save a history record for you (without worrying about space, it will use a very advanced method for incremental storage, it saves much space every time you copy data)



I have almost finished introducing how to use git to work. I have not mentioned a very important feature. How can I restore files of previous versions? It's easy. Check the history of the file to be restored and select revert!


Even if you are not familiar with programming, I believe the above explanation can also teach you how to use it. Come and try it!

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.