Part 1: Reflection on In-Class Git Instructions
This exercise comprehensively covered the basic functionalities and workflow of Git, allowing us to experience the power of version control through hands-on practice. Below are my key takeaways from this exercise:
Initialization and Basic Commits
At the beginning of the exercise, we used git init
, git add
, and git commit
to familiarize ourselves with adding files to version control. By repeatedly checking git status
and git log
, we gained a clear understanding of how each operation affects the repository.
Change Tracking and Differences
After modifying files, we used git diff
to compare the differences between commits. This gave me a deep understanding of the importance of version control—not only for recording history but also for precisely identifying changes. This is particularly useful for debugging and tracking modifications.
Understanding Git’s Internal Structure
By using git cat-file -p
, we explored the structure of commits, trees, and blobs, which helped me understand how Git efficiently stores data. Gaining insights into these underlying mechanisms enhances our ability to utilize Git’s advanced features effectively.
Branch Operations and Merging Strategies
We created a new branch called potential_jokes
in this exercise and added new content in different branches. Switching between branches, observing changes in the working directory, and merging branches highlighted the importance of branching in parallel development. Additionally, we intentionally introduced merge conflicts to learn how to resolve them using git mergetool
.
Accidental Deletion and File Recovery (git restore
)
This part of the exercise made me realize the importance of git restore
, especially in collaborative development where erroneous versions can cause significant issues. In our Web Extension project, we encountered a similar situation—an incorrect version caused the entire project to break. Ultimately, we used git restore
to revert to the previous correct version, successfully restoring the project. This experience reinforced the idea that Git is not just a version control tool but also a “lifeline” that allows us to quickly recover from critical issues and maintain a stable development environment.
Squashing Commits
Although the exercise only briefly touched on squashing commits, it provided valuable insight into maintaining a clean commit history. By merging multiple commits into one, we can keep the history concise and organized, making future maintenance and collaboration more manageable.
Overall, this Git exercise gave me a deep understanding of version control in real-world development. From tracking files to managing complex branches, resolving conflicts, and restoring data, every step contributes to a solid foundation for effective collaboration and code management. In particular, git restore
proved to be a powerful tool for handling unexpected issues and ensuring project stability. Through these hands-on experiences, I gained a more comprehensive understanding of Git’s workflow and internal mechanisms, preparing me for more advanced project management in the future.