{"id":22887599,"url":"https://github.com/imjching/git-museum","last_synced_at":"2025-03-31T19:14:09.006Z","repository":{"id":77658491,"uuid":"127499141","full_name":"imjching/git-museum","owner":"imjching","description":"Git Source Code (v1.0.0) - https://git.kernel.org/pub/scm/git/git.git/tag/?h=v1.0.0","archived":false,"fork":false,"pushed_at":"2018-03-31T04:44:23.000Z","size":792,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-02-06T23:31:12.889Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/imjching.png","metadata":{"files":{"readme":"README","changelog":null,"contributing":null,"funding":null,"license":"COPYING","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2018-03-31T04:35:45.000Z","updated_at":"2018-03-31T04:44:26.000Z","dependencies_parsed_at":null,"dependency_job_id":"f3920a48-743c-40fb-8a3d-b29b9531af5c","html_url":"https://github.com/imjching/git-museum","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/imjching%2Fgit-museum","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/imjching%2Fgit-museum/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/imjching%2Fgit-museum/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/imjching%2Fgit-museum/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/imjching","download_url":"https://codeload.github.com/imjching/git-museum/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246523866,"owners_count":20791444,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-12-13T20:36:50.307Z","updated_at":"2025-03-31T19:14:08.962Z","avatar_url":"https://github.com/imjching.png","language":"C","funding_links":[],"categories":[],"sub_categories":[],"readme":"////////////////////////////////////////////////////////////////\n\n\tGIT - the stupid content tracker\n\n////////////////////////////////////////////////////////////////\n\"git\" can mean anything, depending on your mood.\n\n - random three-letter combination that is pronounceable, and not\n   actually used by any common UNIX command.  The fact that it is a\n   mispronunciation of \"get\" may or may not be relevant.\n - stupid. contemptible and despicable. simple. Take your pick from the\n   dictionary of slang.\n - \"global information tracker\": you're in a good mood, and it actually\n   works for you. Angels sing, and a light suddenly fills the room. \n - \"goddamn idiotic truckload of sh*t\": when it breaks\n\nThis is a stupid (but extremely fast) directory content manager.  It\ndoesn't do a whole lot, but what it 'does' do is track directory\ncontents efficiently. \n\nThere are two object abstractions: the \"object database\", and the\n\"current directory cache\" aka \"index\".\n\nThe Object Database\n~~~~~~~~~~~~~~~~~~~\nThe object database is literally just a content-addressable collection\nof objects.  All objects are named by their content, which is\napproximated by the SHA1 hash of the object itself.  Objects may refer\nto other objects (by referencing their SHA1 hash), and so you can\nbuild up a hierarchy of objects.\n\nAll objects have a statically determined \"type\" aka \"tag\", which is\ndetermined at object creation time, and which identifies the format of\nthe object (i.e. how it is used, and how it can refer to other\nobjects).  There are currently four different object types: \"blob\",\n\"tree\", \"commit\" and \"tag\".\n\nA \"blob\" object cannot refer to any other object, and is, like the type\nimplies, a pure storage object containing some user data.  It is used to\nactually store the file data, i.e. a blob object is associated with some\nparticular version of some file. \n\nA \"tree\" object is an object that ties one or more \"blob\" objects into a\ndirectory structure. In addition, a tree object can refer to other tree\nobjects, thus creating a directory hierarchy. \n\nA \"commit\" object ties such directory hierarchies together into\na DAG of revisions - each \"commit\" is associated with exactly one tree\n(the directory hierarchy at the time of the commit). In addition, a\n\"commit\" refers to one or more \"parent\" commit objects that describe the\nhistory of how we arrived at that directory hierarchy.\n\nAs a special case, a commit object with no parents is called the \"root\"\nobject, and is the point of an initial project commit.  Each project\nmust have at least one root, and while you can tie several different\nroot objects together into one project by creating a commit object which\nhas two or more separate roots as its ultimate parents, that's probably\njust going to confuse people.  So aim for the notion of \"one root object\nper project\", even if git itself does not enforce that. \n\nA \"tag\" object symbolically identifies and can be used to sign other\nobjects. It contains the identifier and type of another object, a\nsymbolic name (of course!) and, optionally, a signature.\n\nRegardless of object type, all objects share the following\ncharacteristics: they are all deflated with zlib, and have a header\nthat not only specifies their type, but also provides size information\nabout the data in the object.  It's worth noting that the SHA1 hash\nthat is used to name the object is the hash of the original data\nplus this header, so `sha1sum` 'file' does not match the object name\nfor 'file'.\n(Historical note: in the dawn of the age of git the hash\nwas the sha1 of the 'compressed' object.)\n\nAs a result, the general consistency of an object can always be tested\nindependently of the contents or the type of the object: all objects can\nbe validated by verifying that (a) their hashes match the content of the\nfile and (b) the object successfully inflates to a stream of bytes that\nforms a sequence of \u003cascii type without space\u003e + \u003cspace\u003e + \u003cascii decimal\nsize\u003e + \u003cbyte\\0\u003e + \u003cbinary object data\u003e. \n\nThe structured objects can further have their structure and\nconnectivity to other objects verified. This is generally done with\nthe `git-fsck-objects` program, which generates a full dependency graph\nof all objects, and verifies their internal consistency (in addition\nto just verifying their superficial consistency through the hash).\n\nThe object types in some more detail:\n\nBlob Object\n~~~~~~~~~~~\nA \"blob\" object is nothing but a binary blob of data, and doesn't\nrefer to anything else.  There is no signature or any other\nverification of the data, so while the object is consistent (it 'is'\nindexed by its sha1 hash, so the data itself is certainly correct), it\nhas absolutely no other attributes.  No name associations, no\npermissions.  It is purely a blob of data (i.e. normally \"file\ncontents\").\n\nIn particular, since the blob is entirely defined by its data, if two\nfiles in a directory tree (or in multiple different versions of the\nrepository) have the same contents, they will share the same blob\nobject. The object is totally independent of its location in the\ndirectory tree, and renaming a file does not change the object that\nfile is associated with in any way.\n\nA blob is typically created when gitlink:git-update-index[1]\nis run, and its data can be accessed by gitlink:git-cat-file[1].\n\nTree Object\n~~~~~~~~~~~\nThe next hierarchical object type is the \"tree\" object.  A tree object\nis a list of mode/name/blob data, sorted by name.  Alternatively, the\nmode data may specify a directory mode, in which case instead of\nnaming a blob, that name is associated with another TREE object.\n\nLike the \"blob\" object, a tree object is uniquely determined by the\nset contents, and so two separate but identical trees will always\nshare the exact same object. This is true at all levels, i.e. it's\ntrue for a \"leaf\" tree (which does not refer to any other trees, only\nblobs) as well as for a whole subdirectory.\n\nFor that reason a \"tree\" object is just a pure data abstraction: it\nhas no history, no signatures, no verification of validity, except\nthat since the contents are again protected by the hash itself, we can\ntrust that the tree is immutable and its contents never change.\n\nSo you can trust the contents of a tree to be valid, the same way you\ncan trust the contents of a blob, but you don't know where those\ncontents 'came' from.\n\nSide note on trees: since a \"tree\" object is a sorted list of\n\"filename+content\", you can create a diff between two trees without\nactually having to unpack two trees.  Just ignore all common parts,\nand your diff will look right.  In other words, you can effectively\n(and efficiently) tell the difference between any two random trees by\nO(n) where \"n\" is the size of the difference, rather than the size of\nthe tree.\n\nSide note 2 on trees: since the name of a \"blob\" depends entirely and\nexclusively on its contents (i.e. there are no names or permissions\ninvolved), you can see trivial renames or permission changes by\nnoticing that the blob stayed the same.  However, renames with data\nchanges need a smarter \"diff\" implementation.\n\nA tree is created with gitlink:git-write-tree[1] and\nits data can be accessed by gitlink:git-ls-tree[1].\nTwo trees can be compared with gitlink:git-diff-tree[1].\n\nCommit Object\n~~~~~~~~~~~~~\nThe \"commit\" object is an object that introduces the notion of\nhistory into the picture.  In contrast to the other objects, it\ndoesn't just describe the physical state of a tree, it describes how\nwe got there, and why.\n\nA \"commit\" is defined by the tree-object that it results in, the\nparent commits (zero, one or more) that led up to that point, and a\ncomment on what happened.  Again, a commit is not trusted per se:\nthe contents are well-defined and \"safe\" due to the cryptographically\nstrong signatures at all levels, but there is no reason to believe\nthat the tree is \"good\" or that the merge information makes sense.\nThe parents do not have to actually have any relationship with the\nresult, for example.\n\nNote on commits: unlike real SCM's, commits do not contain\nrename information or file mode change information.  All of that is\nimplicit in the trees involved (the result tree, and the result trees\nof the parents), and describing that makes no sense in this idiotic\nfile manager.\n\nA commit is created with gitlink:git-commit-tree[1] and\nits data can be accessed by gitlink:git-cat-file[1].\n\nTrust\n~~~~~\nAn aside on the notion of \"trust\". Trust is really outside the scope\nof \"git\", but it's worth noting a few things.  First off, since\neverything is hashed with SHA1, you 'can' trust that an object is\nintact and has not been messed with by external sources.  So the name\nof an object uniquely identifies a known state - just not a state that\nyou may want to trust.\n\nFurthermore, since the SHA1 signature of a commit refers to the\nSHA1 signatures of the tree it is associated with and the signatures\nof the parent, a single named commit specifies uniquely a whole set\nof history, with full contents.  You can't later fake any step of the\nway once you have the name of a commit.\n\nSo to introduce some real trust in the system, the only thing you need\nto do is to digitally sign just 'one' special note, which includes the\nname of a top-level commit.  Your digital signature shows others\nthat you trust that commit, and the immutability of the history of\ncommits tells others that they can trust the whole history.\n\nIn other words, you can easily validate a whole archive by just\nsending out a single email that tells the people the name (SHA1 hash)\nof the top commit, and digitally sign that email using something\nlike GPG/PGP.\n\nTo assist in this, git also provides the tag object...\n\nTag Object\n~~~~~~~~~~\nGit provides the \"tag\" object to simplify creating, managing and\nexchanging symbolic and signed tokens.  The \"tag\" object at its\nsimplest simply symbolically identifies another object by containing\nthe sha1, type and symbolic name.\n\nHowever it can optionally contain additional signature information\n(which git doesn't care about as long as there's less than 8k of\nit). This can then be verified externally to git.\n\nNote that despite the tag features, \"git\" itself only handles content\nintegrity; the trust framework (and signature provision and\nverification) has to come from outside.\n\nA tag is created with gitlink:git-mktag[1],\nits data can be accessed by gitlink:git-cat-file[1],\nand the signature can be verified by\ngitlink:git-verify-tag[1].\n\n\nThe \"index\" aka \"Current Directory Cache\"\n-----------------------------------------\nThe index is a simple binary file, which contains an efficient\nrepresentation of a virtual directory content at some random time.  It\ndoes so by a simple array that associates a set of names, dates,\npermissions and content (aka \"blob\") objects together.  The cache is\nalways kept ordered by name, and names are unique (with a few very\nspecific rules) at any point in time, but the cache has no long-term\nmeaning, and can be partially updated at any time.\n\nIn particular, the index certainly does not need to be consistent with\nthe current directory contents (in fact, most operations will depend on\ndifferent ways to make the index 'not' be consistent with the directory\nhierarchy), but it has three very important attributes:\n\n'(a) it can re-generate the full state it caches (not just the\ndirectory structure: it contains pointers to the \"blob\" objects so\nthat it can regenerate the data too)'\n\nAs a special case, there is a clear and unambiguous one-way mapping\nfrom a current directory cache to a \"tree object\", which can be\nefficiently created from just the current directory cache without\nactually looking at any other data.  So a directory cache at any one\ntime uniquely specifies one and only one \"tree\" object (but has\nadditional data to make it easy to match up that tree object with what\nhas happened in the directory)\n\n'(b) it has efficient methods for finding inconsistencies between that\ncached state (\"tree object waiting to be instantiated\") and the\ncurrent state.'\n\n'(c) it can additionally efficiently represent information about merge\nconflicts between different tree objects, allowing each pathname to be\nassociated with sufficient information about the trees involved that\nyou can create a three-way merge between them.'\n\nThose are the three ONLY things that the directory cache does.  It's a\ncache, and the normal operation is to re-generate it completely from a\nknown tree object, or update/compare it with a live tree that is being\ndeveloped.  If you blow the directory cache away entirely, you generally\nhaven't lost any information as long as you have the name of the tree\nthat it described. \n\nAt the same time, the index is at the same time also the\nstaging area for creating new trees, and creating a new tree always\ninvolves a controlled modification of the index file.  In particular,\nthe index file can have the representation of an intermediate tree that\nhas not yet been instantiated.  So the index can be thought of as a\nwrite-back cache, which can contain dirty information that has not yet\nbeen written back to the backing store.\n\n\n\nThe Workflow\n------------\nGenerally, all \"git\" operations work on the index file. Some operations\nwork *purely* on the index file (showing the current state of the\nindex), but most operations move data to and from the index file. Either\nfrom the database or from the working directory. Thus there are four\nmain combinations: \n\n1) working directory -\u003e index\n~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n\nYou update the index with information from the working directory with\nthe gitlink:git-update-index[1] command.  You\ngenerally update the index information by just specifying the filename\nyou want to update, like so:\n\n\tgit-update-index filename\n\nbut to avoid common mistakes with filename globbing etc, the command\nwill not normally add totally new entries or remove old entries,\ni.e. it will normally just update existing cache entries.\n\nTo tell git that yes, you really do realize that certain files no\nlonger exist, or that new files should be added, you\nshould use the `--remove` and `--add` flags respectively.\n\nNOTE! A `--remove` flag does 'not' mean that subsequent filenames will\nnecessarily be removed: if the files still exist in your directory\nstructure, the index will be updated with their new status, not\nremoved. The only thing `--remove` means is that update-cache will be\nconsidering a removed file to be a valid thing, and if the file really\ndoes not exist any more, it will update the index accordingly.\n\nAs a special case, you can also do `git-update-index --refresh`, which\nwill refresh the \"stat\" information of each index to match the current\nstat information. It will 'not' update the object status itself, and\nit will only update the fields that are used to quickly test whether\nan object still matches its old backing store object.\n\n2) index -\u003e object database\n~~~~~~~~~~~~~~~~~~~~~~~~~~~\n\nYou write your current index file to a \"tree\" object with the program\n\n\tgit-write-tree\n\nthat doesn't come with any options - it will just write out the\ncurrent index into the set of tree objects that describe that state,\nand it will return the name of the resulting top-level tree. You can\nuse that tree to re-generate the index at any time by going in the\nother direction:\n\n3) object database -\u003e index\n~~~~~~~~~~~~~~~~~~~~~~~~~~~\n\nYou read a \"tree\" file from the object database, and use that to\npopulate (and overwrite - don't do this if your index contains any\nunsaved state that you might want to restore later!) your current\nindex.  Normal operation is just\n\n\t\tgit-read-tree \u003csha1 of tree\u003e\n\nand your index file will now be equivalent to the tree that you saved\nearlier. However, that is only your 'index' file: your working\ndirectory contents have not been modified.\n\n4) index -\u003e working directory\n~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n\nYou update your working directory from the index by \"checking out\"\nfiles. This is not a very common operation, since normally you'd just\nkeep your files updated, and rather than write to your working\ndirectory, you'd tell the index files about the changes in your\nworking directory (i.e. `git-update-index`).\n\nHowever, if you decide to jump to a new version, or check out somebody\nelse's version, or just restore a previous tree, you'd populate your\nindex file with read-tree, and then you need to check out the result\nwith\n\n\t\tgit-checkout-index filename\n\nor, if you want to check out all of the index, use `-a`.\n\nNOTE! git-checkout-index normally refuses to overwrite old files, so\nif you have an old version of the tree already checked out, you will\nneed to use the \"-f\" flag ('before' the \"-a\" flag or the filename) to\n'force' the checkout.\n\n\nFinally, there are a few odds and ends which are not purely moving\nfrom one representation to the other:\n\n5) Tying it all together\n~~~~~~~~~~~~~~~~~~~~~~~~\nTo commit a tree you have instantiated with \"git-write-tree\", you'd\ncreate a \"commit\" object that refers to that tree and the history\nbehind it - most notably the \"parent\" commits that preceded it in\nhistory.\n\nNormally a \"commit\" has one parent: the previous state of the tree\nbefore a certain change was made. However, sometimes it can have two\nor more parent commits, in which case we call it a \"merge\", due to the\nfact that such a commit brings together (\"merges\") two or more\nprevious states represented by other commits.\n\nIn other words, while a \"tree\" represents a particular directory state\nof a working directory, a \"commit\" represents that state in \"time\",\nand explains how we got there.\n\nYou create a commit object by giving it the tree that describes the\nstate at the time of the commit, and a list of parents:\n\n\tgit-commit-tree \u003ctree\u003e -p \u003cparent\u003e [-p \u003cparent2\u003e ..]\n\nand then giving the reason for the commit on stdin (either through\nredirection from a pipe or file, or by just typing it at the tty).\n\ngit-commit-tree will return the name of the object that represents\nthat commit, and you should save it away for later use. Normally,\nyou'd commit a new `HEAD` state, and while git doesn't care where you\nsave the note about that state, in practice we tend to just write the\nresult to the file pointed at by `.git/HEAD`, so that we can always see\nwhat the last committed state was.\n\nHere is an ASCII art by Jon Loeliger that illustrates how\nvarious pieces fit together.\n\n------------\n\n                     commit-tree\n                      commit obj\n                       +----+\n                       |    |\n                       |    |\n                       V    V\n                    +-----------+\n                    | Object DB |\n                    |  Backing  |\n                    |   Store   |\n                    +-----------+\n                       ^\n           write-tree  |     |\n             tree obj  |     |\n                       |     |  read-tree\n                       |     |  tree obj\n                             V\n                    +-----------+\n                    |   Index   |\n                    |  \"cache\"  |\n                    +-----------+\n         update-index  ^\n             blob obj  |     |\n                       |     |\n    checkout-index -u  |     |  checkout-index\n             stat      |     |  blob obj\n                             V\n                    +-----------+\n                    |  Working  |\n                    | Directory |\n                    +-----------+\n\n------------\n\n\n6) Examining the data\n~~~~~~~~~~~~~~~~~~~~~\n\nYou can examine the data represented in the object database and the\nindex with various helper tools. For every object, you can use\ngitlink:git-cat-file[1] to examine details about the\nobject:\n\n\t\tgit-cat-file -t \u003cobjectname\u003e\n\nshows the type of the object, and once you have the type (which is\nusually implicit in where you find the object), you can use\n\n\t\tgit-cat-file blob|tree|commit|tag \u003cobjectname\u003e\n\nto show its contents. NOTE! Trees have binary content, and as a result\nthere is a special helper for showing that content, called\n`git-ls-tree`, which turns the binary content into a more easily\nreadable form.\n\nIt's especially instructive to look at \"commit\" objects, since those\ntend to be small and fairly self-explanatory. In particular, if you\nfollow the convention of having the top commit name in `.git/HEAD`,\nyou can do\n\n\t\tgit-cat-file commit HEAD\n\nto see what the top commit was.\n\n7) Merging multiple trees\n~~~~~~~~~~~~~~~~~~~~~~~~~\n\nGit helps you do a three-way merge, which you can expand to n-way by\nrepeating the merge procedure arbitrary times until you finally\n\"commit\" the state.  The normal situation is that you'd only do one\nthree-way merge (two parents), and commit it, but if you like to, you\ncan do multiple parents in one go.\n\nTo do a three-way merge, you need the two sets of \"commit\" objects\nthat you want to merge, use those to find the closest common parent (a\nthird \"commit\" object), and then use those commit objects to find the\nstate of the directory (\"tree\" object) at these points.\n\nTo get the \"base\" for the merge, you first look up the common parent\nof two commits with\n\n\t\tgit-merge-base \u003ccommit1\u003e \u003ccommit2\u003e\n\nwhich will return you the commit they are both based on.  You should\nnow look up the \"tree\" objects of those commits, which you can easily\ndo with (for example)\n\n\t\tgit-cat-file commit \u003ccommitname\u003e | head -1\n\nsince the tree object information is always the first line in a commit\nobject.\n\nOnce you know the three trees you are going to merge (the one\n\"original\" tree, aka the common case, and the two \"result\" trees, aka\nthe branches you want to merge), you do a \"merge\" read into the\nindex. This will complain if it has to throw away your old index contents, so you should\nmake sure that you've committed those - in fact you would normally\nalways do a merge against your last commit (which should thus match\nwhat you have in your current index anyway).\n\nTo do the merge, do\n\n\t\tgit-read-tree -m -u \u003corigtree\u003e \u003cyourtree\u003e \u003ctargettree\u003e\n\nwhich will do all trivial merge operations for you directly in the\nindex file, and you can just write the result out with\n`git-write-tree`.\n\nHistorical note.  We did not have `-u` facility when this\nsection was first written, so we used to warn that\nthe merge is done in the index file, not in your\nworking tree, and your working tree will not match your\nindex after this step.\nThis is no longer true.  The above command, thanks to `-u`\noption, updates your working tree with the merge results for\npaths that have been trivially merged.\n\n\n8) Merging multiple trees, continued\n~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n\nSadly, many merges aren't trivial. If there are files that have\nbeen added.moved or removed, or if both branches have modified the\nsame file, you will be left with an index tree that contains \"merge\nentries\" in it. Such an index tree can 'NOT' be written out to a tree\nobject, and you will have to resolve any such merge clashes using\nother tools before you can write out the result.\n\nYou can examine such index state with `git-ls-files --unmerged`\ncommand.  An example:\n\n------------------------------------------------\n$ git-read-tree -m $orig HEAD $target\n$ git-ls-files --unmerged\n100644 263414f423d0e4d70dae8fe53fa34614ff3e2860 1\thello.c\n100644 06fa6a24256dc7e560efa5687fa84b51f0263c3a 2\thello.c\n100644 cc44c73eb783565da5831b4d820c962954019b69 3\thello.c\n------------------------------------------------\n\nEach line of the `git-ls-files --unmerged` output begins with\nthe blob mode bits, blob SHA1, 'stage number', and the\nfilename.  The 'stage number' is git's way to say which tree it\ncame from: stage 1 corresponds to `$orig` tree, stage 2 `HEAD`\ntree, and stage3 `$target` tree.\n\nEarlier we said that trivial merges are done inside\n`git-read-tree -m`.  For example, if the file did not change\nfrom `$orig` to `HEAD` nor `$target`, or if the file changed\nfrom `$orig` to `HEAD` and `$orig` to `$target` the same way,\nobviously the final outcome is what is in `HEAD`.  What the\nabove example shows is that file `hello.c` was changed from\n`$orig` to `HEAD` and `$orig` to `$target` in a different way.\nYou could resolve this by running your favorite 3-way merge\nprogram, e.g.  `diff3` or `merge`, on the blob objects from\nthese three stages yourself, like this:\n\n------------------------------------------------\n$ git-cat-file blob 263414f... \u003ehello.c~1\n$ git-cat-file blob 06fa6a2... \u003ehello.c~2\n$ git-cat-file blob cc44c73... \u003ehello.c~3\n$ merge hello.c~2 hello.c~1 hello.c~3\n------------------------------------------------\n\nThis would leave the merge result in `hello.c~2` file, along\nwith conflict markers if there are conflicts.  After verifying\nthe merge result makes sense, you can tell git what the final\nmerge result for this file is by:\n\n\tmv -f hello.c~2 hello.c\n\tgit-update-index hello.c\n\nWhen a path is in unmerged state, running `git-update-index` for\nthat path tells git to mark the path resolved.\n\nThe above is the description of a git merge at the lowest level,\nto help you understand what conceptually happens under the hood.\nIn practice, nobody, not even git itself, uses three `git-cat-file`\nfor this.  There is `git-merge-index` program that extracts the\nstages to temporary files and calls a \"merge\" script on it:\n\n\tgit-merge-index git-merge-one-file hello.c\n\nand that is what higher level `git resolve` is implemented with.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fimjching%2Fgit-museum","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fimjching%2Fgit-museum","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fimjching%2Fgit-museum/lists"}