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

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.

主站蜘蛛池模板: 苏尼特右旗| 深州市| 凤凰县| 海原县| 余姚市| 安图县| 阿拉善右旗| 姚安县| 怀集县| 友谊县| 桃园县| 福鼎市| 湘西| 乳山市| 松原市| 清丰县| 奇台县| 怀集县| 丁青县| 兴文县| 子长县| 特克斯县| 繁昌县| 汨罗市| 平舆县| 营山县| 麻阳| 布拖县| 广州市| 兴城市| 报价| 双江| 滦平县| 邢台县| 井冈山市| 马关县| 焦作市| 滁州市| 桃园市| 即墨市| 互助|