- Daniel Arbuckle's Mastering Python
- Daniel Arbuckle
- 193字
- 2021-07-02 21:09:42
Undoing the changes
The nice thing about having old project states saved away is that we can go back to them.
For example, let's say we have made some changes in our file.txt file from moo cow to moo aardvark, as shown in the following screenshots:


If we want to revert a file to a previous state, undoing everything we've done to that file since a particular commit, we just use the git log command to find the identifier for that commit:
git log
This will lead us to our commit, as shown here:

Then, we use the git checkout command to undo our changes. To use the git checkout command, we just need to enter the commit and the filename and you will get to undo the changes, as shown here:

If we later change our minds, we can redo the changes in the same way. The ability to undo on the project level is great, but it's even more useful to make provisional changes to our code and then decide, once the changes are done, whether or not we really want them in our main code. That's what branches are for.
- JMeter 性能測試實戰(第2版)
- HTML5+CSS3基礎開發教程(第2版)
- Data Analysis with Stata
- Mastering AndEngine Game Development
- MySQL數據庫基礎實例教程(微課版)
- Mastering Google App Engine
- HDInsight Essentials(Second Edition)
- 劍指MySQL:架構、調優與運維
- Teaching with Google Classroom
- Kubernetes源碼剖析
- ScratchJr趣味編程動手玩:讓孩子用編程講故事
- 運維前線:一線運維專家的運維方法、技巧與實踐
- Web程序設計:ASP.NET(第2版)
- UX Design for Mobile
- Implementing Microsoft Dynamics NAV(Third Edition)