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

Adding a file

Let's create a text file, just to give it a try:

And now what? Is that all? No! We have to tell Git to put this file in your repository, explicitly. Git doesn't do anything that you don't want it to do. If you have some spare or temp files in your repository, Git will not take care of them, but will only remind you that there are some files in your repository that are not under version control (in the next chapter, we will see how to instruct Git to ignore them when necessary).

Okay, back to the topic. I want file.txt under the control of Git, so let's add it, as shown here:

The git add command tells Git that we want it to take care of that file and check it for future modifications.

In response to this command, it could happen that you will see this response message from Git:

warning: LF will be replaced by CRLF in file.txt.

The file will have its original line endings in your working directory.

This is because of the option that we selected when installing Git: Checkout Windows-style, commit Unix-style line endings. Don't worry about it for the moment; we will deal with it later.

Now, let us see if Git obeyed us.

Using the git status command, we can check the status of the repository, as shown in this screenshot:

As we can see, Git has accomplished its work as expected. In this image, we can read words such as branch, master, commit, and unstage. We will look at them briefly, but for the moment, let's ignore them: The purpose of this first experiment is overcome our fear and start playing with Git commands; after all, we have an entire book in which to learn the significant details.

主站蜘蛛池模板: 鞍山市| 凤翔县| 青田县| 阿坝| 平度市| 崇文区| 揭西县| 叙永县| 武威市| 海安县| 正镶白旗| 洛宁县| 象山县| 新邵县| 浦城县| 哈密市| 容城县| 焉耆| 来凤县| 大同县| 潼南县| 驻马店市| 鹿邑县| 镶黄旗| 乌什县| 曲阜市| 林西县| 白银市| 寻乌县| 花莲县| 兴宁市| 嵊州市| 泽州县| 赤壁市| 张家川| 惠州市| 镇巴县| 正定县| 永泰县| 浏阳市| 安龙县|