Git needs to dynamically compute the difference between two commits to see if was changed. For a quick refresher on how we represent Git objects, see the key below. The most important thing to remember is that commits are snapshots, not diffs. I personally recommend that you use -graph whenever using these history walks. It also avoids interleaving two parallel sequences of commits that happen to have been created at the same time. The -graph option shows the relationships between commits and in particular will show when two commits are parallel to each other in the history. To help clarify what is happening with these queries, all examples in this section will assume that the -graph and -oneline options are also specified. It is possible for two changes to happen in parallel and then be connected to the trunk through a merge. One thing to keep in mind with file history queries is that the commit graph structure is still important. This shows commits where their parent has a different Git object at, but there are some subtleties as to which commits are shown, exactly. The primary way to discover which commits recently changed a file is to use git log. In part I we discussed how Git stores object data, and part II covered commit history queries and the commit-graph file as a specialized query index. This post is the third in a series that looks at Git's internals from the perspective of a database. Further, we will see some specialized data structures that accelerate these queries as repositories grow. Some additional history options may be required to discover what happened in certain special cases, such as using cherry-picks across multiple branches or mistakenly resolving merge conflicts incorrectly. We will learn how Git optimizes these queries based on the typical structure of file history and how merges work most of the time. Today, let’s dig into these different file history commands and consider them as a set of queries. Git’s file history commands help users find these important points in time where changes were introduced. Looking at commit messages alone is insufficient for this discovery, and instead it is important to find the changes that modified a specific file or certain lines in that file. Git is the distributed database at the core of your engineering system.īefore making a change to a large software system, it can be critical to understand the reasons why the code is in its current form. This week, we are exploring Git’s internals with the following concept in mind:
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |