{"id":23772,"date":"2023-05-10T03:14:46","date_gmt":"2023-05-10T03:14:46","guid":{"rendered":"https:\/\/www.booksofall.com\/vi\/?post_type=product&#038;p=23772"},"modified":"2023-05-10T03:16:31","modified_gmt":"2023-05-10T03:16:31","slug":"git-magic","status":"publish","type":"product","link":"https:\/\/www.booksofall.com\/vi\/git-magic\/","title":{"rendered":"Git Magic"},"content":{"rendered":"<h2>Introduction<\/h2>\n<p>I\u2019ll use an analogy to introduce version control. See the Wikipedia entry on revision control for a saner explanation.<\/p>\n<h2>Work is Play<\/h2>\n<p>I\u2019ve played computer games almost all my life. In contrast, I only started using <a href=\"https:\/\/www.atlassian.com\/git\/tutorials\/what-is-version-control\">version control<\/a> systems as an adult. I suspect I\u2019m not alone, and comparing the two may make these concepts easier to explain and understand. Think of editing your code, or document, as playing a game. Once you\u2019ve made a lot of progress, you\u2019d like to save. To do so, you click on the\u00a0<i>Save\u00a0<\/i>button in your trusty <a href=\"https:\/\/www.computerhope.com\/jargon\/e\/editor.htm\">editor<\/a>. But this will overwrite the old version. It\u2019s like those old school games which only had one save slot: sure you could save, but you could never go back to an older state. Which was a shame, because your previous save might have been right at an exceptionally fun part of the game that you\u2019d like to revisit one day. Or worse still, your current save is in an unwinnable state, and you have to start again.<\/p>\n<h2>Version Control<\/h2>\n<p>When editing, you can\u00a0<i>Save As\u2026\u00a0<\/i>a different file, or copy the file somewhere first before saving if you want to savour old versions. You can <a href=\"https:\/\/www.barracuda.com\/support\/glossary\/data-compression\">compress<\/a> them too to save space. This is a primitive and labour-intensive form of version control. Computer games improved on this long ago, many of them providing multiple automatically timestamped save slots. Let\u2019s make the problem slightly tougher. Say you have a bunch of files that go together, such as source code for a project, or files for a website. Now if you want to keep an old version you have to archive a whole directory. Keeping many versions around by hand is inconvenient, and quickly becomes expensive. With some computer games, a saved game really does consist of a directory full of files. These games hide this detail from the player and present a convenient interface to manage different versions of this directory. Version control systems are no different. They all have nice interfaces to manage a directory of stuff. You can save the state of the directory every so often, and you can load any one of the saved states later on. Unlike most computer games, they\u2019re usually smart about conserving space. Typically, only a few files change from version to version, and not by much. Storing the differences instead of entire new copies saves room.<\/p>\n<h2>Distributed Control<\/h2>\n<p>Now imagine a very difficult computer game. So difficult to finish that many experienced gamers all over the world decide to team up and share their saved games to try to beat it. Speedruns are real-life examples: players specializing in different levels of the same game collaborate to produce amazing results. How would you set up a system so they can get at each other\u2019s saves easily? And upload new ones? In the old days, every project used centralized version control. A server some- where held all the saved games. Nobody else did. Every player kept at most a few saved games on their machine. When a player wanted to make progress, they\u2019d download the latest save from the main server, play a while, save and upload back to the server for everyone else to use. What if a player wanted to get an older saved game for some reason? Maybe the current saved game is in an unwinnable state because somebody forgot to pick up an object back in level three, and they want to find the latest saved game where the game can still be completed. Or maybe they want to compare two older saved games to see how much work a particular player did. There could be many reasons to want to see an older revision, but the outcome is the same. They have to ask the central server for that old saved game. The more saved games they want, the more they need to communicate. The new generation of version control systems, of which Git is a member, are known as <a href=\"https:\/\/www.confluent.io\/learn\/distributed-systems\/\">distributed systems<\/a>, and can be thought of as a generalization of centralized systems. When players download from the main server they get every saved game, not just the latest one. It\u2019s as if they\u2019re mirroring the <a href=\"https:\/\/www.ibm.com\/docs\/en\/i\/7.3?topic=programs-central-server\">central server<\/a>. This initial cloning operation can be expensive, especially if there\u2019s a long history, but it pays off in the long run. One immediate benefit is that when an old save is desired for any reason, communication with the central server is unnecessary.<\/p>\n","protected":false},"excerpt":{"rendered":"<p><iframe style=\"width: 100%; height: 750px; border: none;\" src=\"https:\/\/online.visual-paradigm.com\/share\/book\/git-magic-1cmyxg12qk?p=1\" frameborder=\"0\" allowfullscreen=\"allowfullscreen\"><\/iframe><\/p>\n","protected":false},"featured_media":23776,"template":"","meta":{"_yoast_wpseo_title":"","_yoast_wpseo_metadesc":"Git is a common distributed version control used in our work. Why not approach it as a game instead of work? Explore the enjoyable side of Git in this book!"},"product_brand":[],"product_cat":[386],"product_tag":[],"class_list":{"0":"post-23772","1":"product","2":"type-product","3":"status-publish","4":"has-post-thumbnail","6":"product_cat-version-control-systems","8":"first","9":"instock","10":"shipping-taxable","11":"product-type-simple"},"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.1.1 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Git Magic - BooksOfAll Vietnamese<\/title>\n<meta name=\"description\" content=\"Git is a common distributed version control used in our work. Why not approach it as a game instead of work? Explore the enjoyable side of Git in this book!\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.booksofall.com\/vi\/git-magic\/\" \/>\n<meta property=\"og:locale\" content=\"vi_VN\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Git Magic - BooksOfAll Vietnamese\" \/>\n<meta property=\"og:description\" content=\"Git is a common distributed version control used in our work. Why not approach it as a game instead of work? Explore the enjoyable side of Git in this book!\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.booksofall.com\/vi\/git-magic\/\" \/>\n<meta property=\"og:site_name\" content=\"BooksOfAll Vietnamese\" \/>\n<meta property=\"article:modified_time\" content=\"2023-05-10T03:16:31+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.booksofall.com\/vi\/wp-content\/uploads\/sites\/10\/2023\/05\/Git-Magic.jpg\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:image\" content=\"https:\/\/www.booksofall.com\/vi\/wp-content\/uploads\/sites\/10\/2023\/05\/Git-Magic.jpg\" \/>\n<meta name=\"twitter:label1\" content=\"\u01af\u1edbc t\u00ednh th\u1eddi gian \u0111\u1ecdc\" \/>\n\t<meta name=\"twitter:data1\" content=\"4 ph\u00fat\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.booksofall.com\/vi\/git-magic\/\",\"url\":\"https:\/\/www.booksofall.com\/vi\/git-magic\/\",\"name\":\"Git Magic - BooksOfAll Vietnamese\",\"isPartOf\":{\"@id\":\"https:\/\/www.booksofall.com\/vi\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/www.booksofall.com\/vi\/git-magic\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/www.booksofall.com\/vi\/git-magic\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/www.booksofall.com\/vi\/wp-content\/uploads\/sites\/10\/2023\/05\/Git-Magic.jpg\",\"datePublished\":\"2023-05-10T03:14:46+00:00\",\"dateModified\":\"2023-05-10T03:16:31+00:00\",\"description\":\"Git is a common distributed version control used in our work. Why not approach it as a game instead of work? Explore the enjoyable side of Git in this book!\",\"breadcrumb\":{\"@id\":\"https:\/\/www.booksofall.com\/vi\/git-magic\/#breadcrumb\"},\"inLanguage\":\"vi\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.booksofall.com\/vi\/git-magic\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"vi\",\"@id\":\"https:\/\/www.booksofall.com\/vi\/git-magic\/#primaryimage\",\"url\":\"https:\/\/www.booksofall.com\/vi\/wp-content\/uploads\/sites\/10\/2023\/05\/Git-Magic.jpg\",\"contentUrl\":\"https:\/\/www.booksofall.com\/vi\/wp-content\/uploads\/sites\/10\/2023\/05\/Git-Magic.jpg\",\"width\":\"827\",\"height\":\"1169\",\"caption\":\"Git Magic\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.booksofall.com\/vi\/git-magic\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/www.booksofall.com\/vi\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Categories\",\"item\":\"https:\/\/www.booksofall.com\/vi\/categories\/\"},{\"@type\":\"ListItem\",\"position\":3,\"name\":\"Git Magic\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.booksofall.com\/vi\/#website\",\"url\":\"https:\/\/www.booksofall.com\/vi\/\",\"name\":\"BooksOfAll Vietnamese\",\"description\":\"Biggest IT eBooks library and learning resources - Free eBooks for programming, computing, artificial intelligence and more.\",\"publisher\":{\"@id\":\"https:\/\/www.booksofall.com\/vi\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.booksofall.com\/vi\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"vi\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/www.booksofall.com\/vi\/#organization\",\"name\":\"BooksOfAll Vietnamese\",\"url\":\"https:\/\/www.booksofall.com\/vi\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"vi\",\"@id\":\"https:\/\/www.booksofall.com\/vi\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/www.booksofall.com\/vi\/wp-content\/uploads\/sites\/10\/2022\/06\/booksofall-logo-2.png\",\"contentUrl\":\"https:\/\/www.booksofall.com\/vi\/wp-content\/uploads\/sites\/10\/2022\/06\/booksofall-logo-2.png\",\"width\":166,\"height\":30,\"caption\":\"BooksOfAll Vietnamese\"},\"image\":{\"@id\":\"https:\/\/www.booksofall.com\/vi\/#\/schema\/logo\/image\/\"}}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Git Magic - BooksOfAll Vietnamese","description":"Git is a common distributed version control used in our work. Why not approach it as a game instead of work? Explore the enjoyable side of Git in this book!","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.booksofall.com\/vi\/git-magic\/","og_locale":"vi_VN","og_type":"article","og_title":"Git Magic - BooksOfAll Vietnamese","og_description":"Git is a common distributed version control used in our work. Why not approach it as a game instead of work? Explore the enjoyable side of Git in this book!","og_url":"https:\/\/www.booksofall.com\/vi\/git-magic\/","og_site_name":"BooksOfAll Vietnamese","article_modified_time":"2023-05-10T03:16:31+00:00","og_image":[{"url":"https:\/\/www.booksofall.com\/vi\/wp-content\/uploads\/sites\/10\/2023\/05\/Git-Magic.jpg","type":"","width":"","height":""}],"twitter_card":"summary_large_image","twitter_image":"https:\/\/www.booksofall.com\/vi\/wp-content\/uploads\/sites\/10\/2023\/05\/Git-Magic.jpg","twitter_misc":{"\u01af\u1edbc t\u00ednh th\u1eddi gian \u0111\u1ecdc":"4 ph\u00fat"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/www.booksofall.com\/vi\/git-magic\/","url":"https:\/\/www.booksofall.com\/vi\/git-magic\/","name":"Git Magic - BooksOfAll Vietnamese","isPartOf":{"@id":"https:\/\/www.booksofall.com\/vi\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.booksofall.com\/vi\/git-magic\/#primaryimage"},"image":{"@id":"https:\/\/www.booksofall.com\/vi\/git-magic\/#primaryimage"},"thumbnailUrl":"https:\/\/www.booksofall.com\/vi\/wp-content\/uploads\/sites\/10\/2023\/05\/Git-Magic.jpg","datePublished":"2023-05-10T03:14:46+00:00","dateModified":"2023-05-10T03:16:31+00:00","description":"Git is a common distributed version control used in our work. Why not approach it as a game instead of work? Explore the enjoyable side of Git in this book!","breadcrumb":{"@id":"https:\/\/www.booksofall.com\/vi\/git-magic\/#breadcrumb"},"inLanguage":"vi","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.booksofall.com\/vi\/git-magic\/"]}]},{"@type":"ImageObject","inLanguage":"vi","@id":"https:\/\/www.booksofall.com\/vi\/git-magic\/#primaryimage","url":"https:\/\/www.booksofall.com\/vi\/wp-content\/uploads\/sites\/10\/2023\/05\/Git-Magic.jpg","contentUrl":"https:\/\/www.booksofall.com\/vi\/wp-content\/uploads\/sites\/10\/2023\/05\/Git-Magic.jpg","width":"827","height":"1169","caption":"Git Magic"},{"@type":"BreadcrumbList","@id":"https:\/\/www.booksofall.com\/vi\/git-magic\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.booksofall.com\/vi\/"},{"@type":"ListItem","position":2,"name":"Categories","item":"https:\/\/www.booksofall.com\/vi\/categories\/"},{"@type":"ListItem","position":3,"name":"Git Magic"}]},{"@type":"WebSite","@id":"https:\/\/www.booksofall.com\/vi\/#website","url":"https:\/\/www.booksofall.com\/vi\/","name":"BooksOfAll Vietnamese","description":"Biggest IT eBooks library and learning resources - Free eBooks for programming, computing, artificial intelligence and more.","publisher":{"@id":"https:\/\/www.booksofall.com\/vi\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.booksofall.com\/vi\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"vi"},{"@type":"Organization","@id":"https:\/\/www.booksofall.com\/vi\/#organization","name":"BooksOfAll Vietnamese","url":"https:\/\/www.booksofall.com\/vi\/","logo":{"@type":"ImageObject","inLanguage":"vi","@id":"https:\/\/www.booksofall.com\/vi\/#\/schema\/logo\/image\/","url":"https:\/\/www.booksofall.com\/vi\/wp-content\/uploads\/sites\/10\/2022\/06\/booksofall-logo-2.png","contentUrl":"https:\/\/www.booksofall.com\/vi\/wp-content\/uploads\/sites\/10\/2022\/06\/booksofall-logo-2.png","width":166,"height":30,"caption":"BooksOfAll Vietnamese"},"image":{"@id":"https:\/\/www.booksofall.com\/vi\/#\/schema\/logo\/image\/"}}]}},"_links":{"self":[{"href":"https:\/\/www.booksofall.com\/vi\/wp-json\/wp\/v2\/product\/23772","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.booksofall.com\/vi\/wp-json\/wp\/v2\/product"}],"about":[{"href":"https:\/\/www.booksofall.com\/vi\/wp-json\/wp\/v2\/types\/product"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.booksofall.com\/vi\/wp-json\/wp\/v2\/media\/23776"}],"wp:attachment":[{"href":"https:\/\/www.booksofall.com\/vi\/wp-json\/wp\/v2\/media?parent=23772"}],"wp:term":[{"taxonomy":"product_brand","embeddable":true,"href":"https:\/\/www.booksofall.com\/vi\/wp-json\/wp\/v2\/product_brand?post=23772"},{"taxonomy":"product_cat","embeddable":true,"href":"https:\/\/www.booksofall.com\/vi\/wp-json\/wp\/v2\/product_cat?post=23772"},{"taxonomy":"product_tag","embeddable":true,"href":"https:\/\/www.booksofall.com\/vi\/wp-json\/wp\/v2\/product_tag?post=23772"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}