官术网_书友最值得收藏!

Setting up a new repository

The first step is to set up a new repository. A repository is a container for your entire project; every file or subfolder within it belongs to that repository, in a consistent manner. Physically, a repository is nothing other than a folder that contains a special .git folder, the folder where the magic happens.

Let's try to make our first repository. Choose a folder you like (for example, C:\Repos\MyFirstRepo), and type the git init command, as shown here:

As you can see, I slightly modified the default Git Bash prompt to better fit the need of the demoing commands; I removed the user and host, and added an incremental number to every command we type so that it will be simpler for me to refer to it while explaining, and for you to refer to it while reading.

Let's get back on topic. What just happened inside the MyFirstRepo folder? Git created a .git subfolder. The subfolder (normally hidden in Windows) contains some other files and folders, as shown in the next screenshot:

At this point in time, it is not important for us to understand what is inside this folder. The only thing you have to know is that you do not have to touch it, ever! If you delete it or if you modify the files inside by hand, you could get into trouble. Have I frightened you enough?

Now that we have a repository, we can start to put files inside it. Git can trace the history of any type of file, text-based or binary, small or large, with the same efficiency (more or less; large files are always a problem).

主站蜘蛛池模板: 宝兴县| 应用必备| 永春县| 台东市| 兰考县| 凉城县| 长宁区| 陵川县| 临漳县| 佛冈县| 辛集市| 舞阳县| 永嘉县| 麦盖提县| 横山县| 昭通市| 淮北市| 河间市| 九江县| 屯昌县| 娄底市| 英德市| 宜章县| 精河县| 南涧| 平山县| 武夷山市| 隆安县| 杨浦区| 腾冲县| 南靖县| 土默特左旗| 乐平市| 称多县| 昆明市| 武宁县| 开江县| 方城县| 乌苏市| 潞西市| 肇源县|