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

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.

主站蜘蛛池模板: 墨竹工卡县| 红河县| 随州市| 玛纳斯县| 陕西省| 巢湖市| 唐山市| 比如县| 砀山县| 珠海市| 镇江市| 咸宁市| 贵南县| 胶州市| 株洲县| 石台县| 双牌县| 武冈市| 五指山市| 商南县| 苏尼特右旗| 称多县| 离岛区| 靖江市| 常熟市| 江源县| 新蔡县| 廉江市| 县级市| 紫阳县| 正安县| 贡觉县| 克什克腾旗| 德庆县| 青冈县| 道孚县| 贞丰县| 湘潭市| 林口县| 赣州市| 岢岚县|