- Git Essentials(Second Edition)
- Ferdinando Santacroce
- 387字
- 2021-07-02 15:27:05
Modifying a committed file
Now, we can try to make some modifications to the file and see how to deal with it, as shown in the following screenshot:

As you can see, the Bash shell warns us that there are some modifications painting the name of the modified files in red. Here, the git status command informs us that there is a file with some modifications, and that we need to commit it if we want to save this modification step in the repository history.
However, what does no changes added to commit mean? It is simple. Git makes you take a second look at what you want to include in the next commit. If you have touched two files but you want to commit only one, you can add only that one.
If you try to commit by skipping the add step, nothing will happen (see the following screenshot). We will analyze this behavior in depth in the next chapter.
So, let's add the file again for the purpose of getting things ready for the next commit:

Okay, let's make another commit, this time, avoiding the --message subcommand. Type git commit and hit the Enter key:

Fasten your seatbelts! You are now entering in a piece of code history!

What is that? It's Vim (Vi IMproved), an ancient and powerful text editor, used even today by millions of people. You can configure Git to use your own preferred editor, but if you don't do it, this is what you have to deal with. Vim is powerful, but for newcomers, it can be a pain to use. It has a strange way of dealing with text. To start typing, you have to press I for inserting text, as shown in the following screenshot:

Once you have typed your commit message, you can press Esc to get out of editing mode. Then, you can type the :w command to write changes and the :q command to quit. You can also type the command in pairs as :wq, as we do in this screenshot, or use the equivalent :x command:

After that, press Enter and another commit is done, as shown here:

Note that when you exit from Vim, Git automatically dispatches the commit, as you can see in the preceding screenshot.
Well done! Now, it's time to recap.
- SQL入門經典(第5版)
- 大數據可視化
- Oracle RAC 11g實戰(zhàn)指南
- 文本數據挖掘:基于R語言
- MySQL從入門到精通(第3版)
- 深入淺出數字孿生
- Learn Unity ML-Agents:Fundamentals of Unity Machine Learning
- 大話Oracle Grid:云時代的RAC
- 大數據架構和算法實現之路:電商系統(tǒng)的技術實戰(zhàn)
- Lego Mindstorms EV3 Essentials
- 白話大數據與機器學習
- 重復數據刪除技術:面向大數據管理的縮減技術
- 探索新型智庫發(fā)展之路:藍迪國際智庫報告·2015(上冊)
- 深入理解InfluxDB:時序數據庫詳解與實踐
- Oracle 11g+ASP.NET數據庫系統(tǒng)開發(fā)案例教程