{"id":270,"date":"2022-11-04T20:43:21","date_gmt":"2022-11-04T20:43:21","guid":{"rendered":"https:\/\/hacking.cool\/?p=270"},"modified":"2024-03-18T05:21:38","modified_gmt":"2024-03-18T05:21:38","slug":"what-is-git-and-how-you-eat-it","status":"publish","type":"post","link":"https:\/\/hacking.cool\/atomanya\/what-is-git-and-how-you-eat-it\/","title":{"rendered":"What is .git and how you eat it?"},"content":{"rendered":"\n<p class=\"has-black-color has-text-color\"><a href=\"https:\/\/git-scm.com\/\" target=\"_blank\" rel=\"noreferrer noopener\">Git<\/a> is an open-source distributed version control system that is available to all kinds of users for free. Git tools work in conjugation with Git repositories.<\/p>\n\n\n\n<p class=\"has-black-color has-text-color\">OK, now in human language&#8230;when you see a .git directory in a web app &#8211; it is good. It means the web app developer by mistake (or not?) deployed \/ left the .git folder of the project exposed. You should download it, cause it will allow you to get access to the web app&#8217;s source code.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"454\" height=\"460\" src=\"https:\/\/hacking.cool\/atomanya\/wp-content\/uploads\/2022\/11\/git.png\" alt=\"\" class=\"wp-image-474\" srcset=\"https:\/\/hacking.cool\/atomanya\/wp-content\/uploads\/2022\/11\/git.png 454w, https:\/\/hacking.cool\/atomanya\/wp-content\/uploads\/2022\/11\/git-100x100.png 100w, https:\/\/hacking.cool\/atomanya\/wp-content\/uploads\/2022\/11\/git-296x300.png 296w\" sizes=\"auto, (max-width: 454px) 100vw, 454px\" \/><\/figure>\n\n\n\n<p class=\"has-black-color has-text-color\">But you can&#8217;t just copy the .git folder and think that&#8217;s it&#8230;you need special special toolz. Tools that will allow you to reconstruct the whole Git repository just from the one exposed .git folder. Get them the damn tools here: https:\/\/github.com\/internetwache\/GitTools<\/p>\n\n\n\n<p class=\"has-black-color has-text-color\">Now we can use the gitdumper.sh and download the whole folder.<\/p>\n\n\n\n<p class=\"has-black-color has-text-color\">\/opt\/GitTools\/Dumper\/gitdumper.sh http:\/\/badsite.ofcourse\/.git\/ git<\/p>\n\n\n\n<p class=\"has-black-color has-text-color\">You can test your luck with finding any interesting info: <\/p>\n\n\n\n<p class=\"has-black-color has-text-color\">\/opt\/GitTools\/Extractor\/extractor.sh .\/ extracted<\/p>\n\n\n\n<p class=\"has-black-color has-text-color\">You can roll back and check if there were any missing files from previous commits, just go where the .git folder was downloaded and type:<\/p>\n\n\n\n<p class=\"has-black-color has-text-color\">git status<\/p>\n\n\n\n<p class=\"has-black-color has-text-color\">If there are any deleted\/missing files, you can go back to the latest version with: <\/p>\n\n\n\n<p class=\"has-black-color has-text-color\">git reset &#8211;hard<\/p>\n\n\n\n<p class=\"has-black-color has-text-color\">To check history of all commits:<\/p>\n\n\n\n<p class=\"has-black-color has-text-color\">git logs<\/p>\n\n\n\n<p class=\"has-black-color has-text-color\">Some theoretical basis would be good to get, learn about git branches:<\/p>\n\n\n\n<p class=\"has-black-color has-text-color\"><a href=\"https:\/\/git-scm.com\/book\/en\/v2\/Git-Branching-Branches-in-a-Nutshell\">https:\/\/git-scm.com\/book\/en\/v2\/Git-Branching-Branches-in-a-Nutshell<\/a><\/p>\n\n\n\n<p class=\"has-black-color has-text-color\">In simple words, &#8220;branch&#8221; is a thingy that points to one of the saved versions of your project and &#8216;master&#8217; branch is one of the default &#8220;branches&#8221; which points to the very last version of your project (last commit).<\/p>\n\n\n\n<p class=\"has-black-color has-text-color\">To switch to another branch\/pointer, just type: git checkout [name_of_the_branch]<\/p>\n\n\n\n<p class=\"has-black-color has-text-color\">For instance, if there was a file test.php that is missing in the current commit, you can check if that file is present in previous commits and restore it. Here is the command to restore the file present in the last commit: <\/p>\n\n\n\n<p class=\"has-black-color has-text-color\">git checkout HEAD test.php<\/p>\n\n\n\n<p class=\"has-black-color has-text-color\"><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Git is an open-source distributed version control system that is available to all kinds of users for free. Git tools work in conjugation with Git repositories. OK, now in human language&#8230;when you see a .git directory in a web app &#8211; it is good. It means the web app developer by mistake (or not?) deployed<span class=\"post-excerpt-end\">&hellip;<\/span><\/p>\n<p class=\"more-link\"><a href=\"https:\/\/hacking.cool\/atomanya\/what-is-git-and-how-you-eat-it\/\" class=\"themebutton\">Read More<\/a><\/p>\n","protected":false},"author":3,"featured_media":857,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_mi_skip_tracking":false,"footnotes":""},"categories":[4],"tags":[],"class_list":["post-270","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-articles"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v19.3 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>What is .git and how you eat it? - hacking.cool<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/hacking.cool\/atomanya\/what-is-git-and-how-you-eat-it\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"What is .git and how you eat it? - hacking.cool\" \/>\n<meta property=\"og:description\" content=\"Git is an open-source distributed version control system that is available to all kinds of users for free. Git tools work in conjugation with Git repositories. OK, now in human language&#8230;when you see a .git directory in a web app &#8211; it is good. It means the web app developer by mistake (or not?) deployed&hellip;Read More\" \/>\n<meta property=\"og:url\" content=\"https:\/\/hacking.cool\/atomanya\/what-is-git-and-how-you-eat-it\/\" \/>\n<meta property=\"og:site_name\" content=\"hacking.cool\" \/>\n<meta property=\"article:published_time\" content=\"2022-11-04T20:43:21+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2024-03-18T05:21:38+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/hacking.cool\/atomanya\/wp-content\/uploads\/2022\/11\/65f7c8fa9020822.png\" \/>\n\t<meta property=\"og:image:width\" content=\"811\" \/>\n\t<meta property=\"og:image:height\" content=\"610\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/png\" \/>\n<meta name=\"author\" content=\"Atom\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Atom\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"2 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebSite\",\"@id\":\"https:\/\/hacking.cool\/atomanya\/#website\",\"url\":\"https:\/\/hacking.cool\/atomanya\/\",\"name\":\"hacking.cool\",\"description\":\"is the hacking school \ud83d\udc69\ud83c\udffb\u200d\ud83d\udcbb\ud83e\uddd1\ud83c\udffb\u200d\ud83d\udcbb\ud83d\uddfa\ud83d\udcda\ud83d\udcd6\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/hacking.cool\/atomanya\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"en-US\"},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/hacking.cool\/atomanya\/what-is-git-and-how-you-eat-it\/#primaryimage\",\"url\":\"https:\/\/hacking.cool\/atomanya\/wp-content\/uploads\/2022\/11\/65f7c8fa9020822.png\",\"contentUrl\":\"https:\/\/hacking.cool\/atomanya\/wp-content\/uploads\/2022\/11\/65f7c8fa9020822.png\",\"width\":811,\"height\":610},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/hacking.cool\/atomanya\/what-is-git-and-how-you-eat-it\/\",\"url\":\"https:\/\/hacking.cool\/atomanya\/what-is-git-and-how-you-eat-it\/\",\"name\":\"What is .git and how you eat it? - hacking.cool\",\"isPartOf\":{\"@id\":\"https:\/\/hacking.cool\/atomanya\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/hacking.cool\/atomanya\/what-is-git-and-how-you-eat-it\/#primaryimage\"},\"datePublished\":\"2022-11-04T20:43:21+00:00\",\"dateModified\":\"2024-03-18T05:21:38+00:00\",\"author\":{\"@id\":\"https:\/\/hacking.cool\/atomanya\/#\/schema\/person\/804a839cfa61d89d69fb2cf1d2f0adc2\"},\"breadcrumb\":{\"@id\":\"https:\/\/hacking.cool\/atomanya\/what-is-git-and-how-you-eat-it\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/hacking.cool\/atomanya\/what-is-git-and-how-you-eat-it\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/hacking.cool\/atomanya\/what-is-git-and-how-you-eat-it\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/hacking.cool\/atomanya\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"What is .git and how you eat it?\"}]},{\"@type\":\"Person\",\"@id\":\"https:\/\/hacking.cool\/atomanya\/#\/schema\/person\/804a839cfa61d89d69fb2cf1d2f0adc2\",\"name\":\"Atom\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/hacking.cool\/atomanya\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/ac4d05ec7d617e7f2dee5855900a855a?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/ac4d05ec7d617e7f2dee5855900a855a?s=96&d=mm&r=g\",\"caption\":\"Atom\"},\"url\":\"https:\/\/hacking.cool\/atomanya\/author\/atom\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"What is .git and how you eat it? - hacking.cool","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:\/\/hacking.cool\/atomanya\/what-is-git-and-how-you-eat-it\/","og_locale":"en_US","og_type":"article","og_title":"What is .git and how you eat it? - hacking.cool","og_description":"Git is an open-source distributed version control system that is available to all kinds of users for free. Git tools work in conjugation with Git repositories. OK, now in human language&#8230;when you see a .git directory in a web app &#8211; it is good. It means the web app developer by mistake (or not?) deployed&hellip;Read More","og_url":"https:\/\/hacking.cool\/atomanya\/what-is-git-and-how-you-eat-it\/","og_site_name":"hacking.cool","article_published_time":"2022-11-04T20:43:21+00:00","article_modified_time":"2024-03-18T05:21:38+00:00","og_image":[{"width":811,"height":610,"url":"https:\/\/hacking.cool\/atomanya\/wp-content\/uploads\/2022\/11\/65f7c8fa9020822.png","type":"image\/png"}],"author":"Atom","twitter_card":"summary_large_image","twitter_misc":{"Written by":"Atom","Est. reading time":"2 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebSite","@id":"https:\/\/hacking.cool\/atomanya\/#website","url":"https:\/\/hacking.cool\/atomanya\/","name":"hacking.cool","description":"is the hacking school \ud83d\udc69\ud83c\udffb\u200d\ud83d\udcbb\ud83e\uddd1\ud83c\udffb\u200d\ud83d\udcbb\ud83d\uddfa\ud83d\udcda\ud83d\udcd6","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/hacking.cool\/atomanya\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"en-US"},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/hacking.cool\/atomanya\/what-is-git-and-how-you-eat-it\/#primaryimage","url":"https:\/\/hacking.cool\/atomanya\/wp-content\/uploads\/2022\/11\/65f7c8fa9020822.png","contentUrl":"https:\/\/hacking.cool\/atomanya\/wp-content\/uploads\/2022\/11\/65f7c8fa9020822.png","width":811,"height":610},{"@type":"WebPage","@id":"https:\/\/hacking.cool\/atomanya\/what-is-git-and-how-you-eat-it\/","url":"https:\/\/hacking.cool\/atomanya\/what-is-git-and-how-you-eat-it\/","name":"What is .git and how you eat it? - hacking.cool","isPartOf":{"@id":"https:\/\/hacking.cool\/atomanya\/#website"},"primaryImageOfPage":{"@id":"https:\/\/hacking.cool\/atomanya\/what-is-git-and-how-you-eat-it\/#primaryimage"},"datePublished":"2022-11-04T20:43:21+00:00","dateModified":"2024-03-18T05:21:38+00:00","author":{"@id":"https:\/\/hacking.cool\/atomanya\/#\/schema\/person\/804a839cfa61d89d69fb2cf1d2f0adc2"},"breadcrumb":{"@id":"https:\/\/hacking.cool\/atomanya\/what-is-git-and-how-you-eat-it\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/hacking.cool\/atomanya\/what-is-git-and-how-you-eat-it\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/hacking.cool\/atomanya\/what-is-git-and-how-you-eat-it\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/hacking.cool\/atomanya\/"},{"@type":"ListItem","position":2,"name":"What is .git and how you eat it?"}]},{"@type":"Person","@id":"https:\/\/hacking.cool\/atomanya\/#\/schema\/person\/804a839cfa61d89d69fb2cf1d2f0adc2","name":"Atom","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/hacking.cool\/atomanya\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/ac4d05ec7d617e7f2dee5855900a855a?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/ac4d05ec7d617e7f2dee5855900a855a?s=96&d=mm&r=g","caption":"Atom"},"url":"https:\/\/hacking.cool\/atomanya\/author\/atom\/"}]}},"jetpack_featured_media_url":"https:\/\/hacking.cool\/atomanya\/wp-content\/uploads\/2022\/11\/65f7c8fa9020822.png","_links":{"self":[{"href":"https:\/\/hacking.cool\/atomanya\/wp-json\/wp\/v2\/posts\/270","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/hacking.cool\/atomanya\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/hacking.cool\/atomanya\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/hacking.cool\/atomanya\/wp-json\/wp\/v2\/users\/3"}],"replies":[{"embeddable":true,"href":"https:\/\/hacking.cool\/atomanya\/wp-json\/wp\/v2\/comments?post=270"}],"version-history":[{"count":13,"href":"https:\/\/hacking.cool\/atomanya\/wp-json\/wp\/v2\/posts\/270\/revisions"}],"predecessor-version":[{"id":475,"href":"https:\/\/hacking.cool\/atomanya\/wp-json\/wp\/v2\/posts\/270\/revisions\/475"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/hacking.cool\/atomanya\/wp-json\/wp\/v2\/media\/857"}],"wp:attachment":[{"href":"https:\/\/hacking.cool\/atomanya\/wp-json\/wp\/v2\/media?parent=270"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/hacking.cool\/atomanya\/wp-json\/wp\/v2\/categories?post=270"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/hacking.cool\/atomanya\/wp-json\/wp\/v2\/tags?post=270"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}