{"id":6865,"date":"2020-01-22T01:01:17","date_gmt":"2020-01-22T00:01:17","guid":{"rendered":"https:\/\/blog.nevercodealone.de\/?p=6865"},"modified":"2020-03-09T00:11:48","modified_gmt":"2020-03-08T23:11:48","slug":"gitignore-clear-cache-files","status":"publish","type":"post","link":"https:\/\/blog.nevercodealone.de\/gitignore-clear-cache-files\/","title":{"rendered":".gitignore clear cache files Linux Command Line"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">Bei Git gibt es manchmal den Usecase f\u00fcr &#8211; .gitignore clear cache files. Das kommt gerade dann vor, wenn ein File urspr\u00fcnglich \u00fcber die .gitignore ignoriert, also ausgeschlossen wurde. Wird die Zeile dann entfernt kommt es oft vor, da\u00df man das gew\u00fcnschte File nicht zu seinem <a href=\"https:\/\/blog.nevercodealone.de\/git-merge-reset\/\">Git-Repository<\/a> hinzuf\u00fcgen kann.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><a href=\"https:\/\/nevercodealone.de\/php-training\" target=\"_blank\" rel=\"noopener noreferrer\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"576\" src=\"https:\/\/blog.nevercodealone.de\/wp-content\/uploads\/2020\/01\/php-training-codeception-inhouse-1024x576.jpg\" alt=\".gitignore clear cache\" class=\"wp-image-6860\" srcset=\"https:\/\/blog.nevercodealone.de\/wp-content\/uploads\/2020\/01\/php-training-codeception-inhouse-1024x576.jpg 1024w, https:\/\/blog.nevercodealone.de\/wp-content\/uploads\/2020\/01\/php-training-codeception-inhouse-300x169.jpg 300w, https:\/\/blog.nevercodealone.de\/wp-content\/uploads\/2020\/01\/php-training-codeception-inhouse-768x432.jpg 768w, https:\/\/blog.nevercodealone.de\/wp-content\/uploads\/2020\/01\/php-training-codeception-inhouse-1536x864.jpg 1536w, https:\/\/blog.nevercodealone.de\/wp-content\/uploads\/2020\/01\/php-training-codeception-inhouse-1170x658.jpg 1170w, https:\/\/blog.nevercodealone.de\/wp-content\/uploads\/2020\/01\/php-training-codeception-inhouse-585x329.jpg 585w, https:\/\/blog.nevercodealone.de\/wp-content\/uploads\/2020\/01\/php-training-codeception-inhouse.jpg 1920w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/a><figcaption>PHP-Training Codeception Inhouse<\/figcaption><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\">Linux Command .gitignore clear cache files &#8211; Filename<\/h2>\n\n\n\n<pre class=\"wp-block-code\"><code>git rm --cached filename<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Das oben abgebildete Linux Command zeigt, wie man eine einzelne Datei aus dem .gitignore Cache entfernt. Ein Usecase kann hier ein .env File sein. Die d\u00fcrfen nat\u00fcrlich unter normalen Umst\u00e4nden nicht mit ins Repo k\u00f6nnen aber eventuell f\u00fcr ein <a href=\"https:\/\/nevercodealone.de\/php-training\/codeception\" target=\"_blank\" rel=\"noreferrer noopener\" aria-label=\"PHP-Training (\u00f6ffnet in neuem Tab)\">PHP-Training<\/a> n\u00f6tig sein. Das richtige Vorgehen ist hier allerdings ein .env.dist File, welches dann zu einem .env File kopiert wird und ignoriert wird. So k\u00f6nnen problemlos eigene Settings vorgenommen werden. Hier lohnt es sich auch das .env File in seiner .gitignore_global einzuf\u00fcgen. Denn wenn die einmal gepusht ist und gerade mit<a href=\"https:\/\/www.geeksforgeeks.org\/social-network-api\/\" target=\"_blank\" rel=\"noreferrer noopener\" aria-label=\" Social Media API Keys (\u00f6ffnet in neuem Tab)\"> Social Media API Keys<\/a> kann das echt unangenehm werden.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Linux Command .gitignore clear cache all files<\/h2>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"512\" src=\"https:\/\/blog.nevercodealone.de\/wp-content\/uploads\/2018\/07\/git-schulung-1024x512.jpg\" alt=\"Junge dem eine Situation peinlich ist und die H\u00e4nde vor das Gesicht schl\u00e4gt\" class=\"wp-image-5348\" srcset=\"https:\/\/blog.nevercodealone.de\/wp-content\/uploads\/2018\/07\/git-schulung.jpg 1024w, https:\/\/blog.nevercodealone.de\/wp-content\/uploads\/2018\/07\/git-schulung-300x150.jpg 300w, https:\/\/blog.nevercodealone.de\/wp-content\/uploads\/2018\/07\/git-schulung-768x384.jpg 768w, https:\/\/blog.nevercodealone.de\/wp-content\/uploads\/2018\/07\/git-schulung-585x293.jpg 585w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><figcaption>Git Schulung f\u00fcr PHP Entwickler<\/figcaption><\/figure>\n\n\n\n<pre class=\"wp-block-code\"><code>git rm -r --cached .<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Und nat\u00fcrlich gibt es hier auch einen Holzhammer. Der ist aber wirklich mit Vorsicht zu genie\u00dfen und geht im Grunde nur, wenn man weder \u00c4nderungen noch neue Files im aktuellen Git Status hat. Alles andere macht keinen sauberen Commit. Und auch dann hat das einfach ein Risiko. Hier werden praktisch alle Files tempor\u00e4r aus dem Git Index entfernt. Die muss man danach dann alle wieder hinzuf\u00fcgen. Zwar sieht man hier dann auch wieder m\u00f6gliche Unterschiede und kann auch mit einem Git Diff Vergleiche durchf\u00fchren. Es ist aber trotzdem einfach nicht sch\u00f6n.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Bei Git gibt es manchmal den Usecase f\u00fcr &#8211; .gitignore clear cache files. Das kommt&hellip;<\/p>\n","protected":false},"author":1,"featured_media":6868,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_crdt_document":"","_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"cybocfi_hide_featured_image":"","footnotes":""},"categories":[98,12],"tags":[32,33],"class_list":["post-6865","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-php-tricks","category-webdevelopment-tools","tag-php","tag-php-schulung"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.0 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>.gitignore clear cache files - Git Ignore Index neu oder Files l\u00f6schen<\/title>\n<meta name=\"description\" content=\"Bei einem .gitignore clear cache kann man einzelne Files l\u00f6schen oder ganzen Git Ignore Index neu einlesen HowTo Tutorial als PHP Training\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/blog.nevercodealone.de\/gitignore-clear-cache-files\/\" \/>\n<meta property=\"og:locale\" content=\"de_DE\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\".gitignore clear cache files - Git Ignore Index neu oder Files l\u00f6schen\" \/>\n<meta property=\"og:description\" content=\"Bei einem .gitignore clear cache kann man einzelne Files l\u00f6schen oder ganzen Git Ignore Index neu einlesen HowTo Tutorial als PHP Training\" \/>\n<meta property=\"og:url\" content=\"https:\/\/blog.nevercodealone.de\/gitignore-clear-cache-files\/\" \/>\n<meta property=\"og:site_name\" content=\"Employer Branding und Tutorials Web Development\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/nevercodealone\/\" \/>\n<meta property=\"article:author\" content=\"https:\/\/www.facebook.com\/roland.golla\" \/>\n<meta property=\"article:published_time\" content=\"2020-01-22T00:01:17+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2020-03-08T23:11:48+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/blog.nevercodealone.de\/wp-content\/uploads\/2020\/01\/gitignore-clear-cache.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"1024\" \/>\n\t<meta property=\"og:image:height\" content=\"512\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"author\" content=\"Roland Golla\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:image\" content=\"https:\/\/blog.nevercodealone.de\/wp-content\/uploads\/2020\/01\/gitignore-clear-cache.jpg\" \/>\n<meta name=\"twitter:creator\" content=\"@https:\/\/twitter.com\/cleancode_devel\" \/>\n<meta name=\"twitter:site\" content=\"@nevercodealone\" \/>\n<meta name=\"twitter:label1\" content=\"Verfasst von\" \/>\n\t<meta name=\"twitter:data1\" content=\"Roland Golla\" \/>\n\t<meta name=\"twitter:label2\" content=\"Gesch\u00e4tzte Lesezeit\" \/>\n\t<meta name=\"twitter:data2\" content=\"1\u00a0Minute\" \/>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":".gitignore clear cache files - Git Ignore Index neu oder Files l\u00f6schen","description":"Bei einem .gitignore clear cache kann man einzelne Files l\u00f6schen oder ganzen Git Ignore Index neu einlesen HowTo Tutorial als PHP Training","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:\/\/blog.nevercodealone.de\/gitignore-clear-cache-files\/","og_locale":"de_DE","og_type":"article","og_title":".gitignore clear cache files - Git Ignore Index neu oder Files l\u00f6schen","og_description":"Bei einem .gitignore clear cache kann man einzelne Files l\u00f6schen oder ganzen Git Ignore Index neu einlesen HowTo Tutorial als PHP Training","og_url":"https:\/\/blog.nevercodealone.de\/gitignore-clear-cache-files\/","og_site_name":"Employer Branding und Tutorials Web Development","article_publisher":"https:\/\/www.facebook.com\/nevercodealone\/","article_author":"https:\/\/www.facebook.com\/roland.golla","article_published_time":"2020-01-22T00:01:17+00:00","article_modified_time":"2020-03-08T23:11:48+00:00","og_image":[{"width":1024,"height":512,"url":"https:\/\/blog.nevercodealone.de\/wp-content\/uploads\/2020\/01\/gitignore-clear-cache.jpg","type":"image\/jpeg"}],"author":"Roland Golla","twitter_card":"summary_large_image","twitter_image":"https:\/\/blog.nevercodealone.de\/wp-content\/uploads\/2020\/01\/gitignore-clear-cache.jpg","twitter_creator":"@https:\/\/twitter.com\/cleancode_devel","twitter_site":"@nevercodealone","twitter_misc":{"Verfasst von":"Roland Golla","Gesch\u00e4tzte Lesezeit":"1\u00a0Minute"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/blog.nevercodealone.de\/gitignore-clear-cache-files\/#article","isPartOf":{"@id":"https:\/\/blog.nevercodealone.de\/gitignore-clear-cache-files\/"},"author":{"name":"Roland Golla","@id":"https:\/\/blog.nevercodealone.de\/#\/schema\/person\/abb634fbea84896d032351009372debb"},"headline":".gitignore clear cache files Linux Command Line","datePublished":"2020-01-22T00:01:17+00:00","dateModified":"2020-03-08T23:11:48+00:00","mainEntityOfPage":{"@id":"https:\/\/blog.nevercodealone.de\/gitignore-clear-cache-files\/"},"wordCount":291,"commentCount":0,"publisher":{"@id":"https:\/\/blog.nevercodealone.de\/#organization"},"image":{"@id":"https:\/\/blog.nevercodealone.de\/gitignore-clear-cache-files\/#primaryimage"},"thumbnailUrl":"https:\/\/blog.nevercodealone.de\/wp-content\/uploads\/2020\/01\/gitignore-clear-cache.jpg","keywords":["PHP","PHP-Schulung"],"articleSection":["PHP-Tricks","Webdevelopment-Tools"],"inLanguage":"de","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/blog.nevercodealone.de\/gitignore-clear-cache-files\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/blog.nevercodealone.de\/gitignore-clear-cache-files\/","url":"https:\/\/blog.nevercodealone.de\/gitignore-clear-cache-files\/","name":".gitignore clear cache files - Git Ignore Index neu oder Files l\u00f6schen","isPartOf":{"@id":"https:\/\/blog.nevercodealone.de\/#website"},"primaryImageOfPage":{"@id":"https:\/\/blog.nevercodealone.de\/gitignore-clear-cache-files\/#primaryimage"},"image":{"@id":"https:\/\/blog.nevercodealone.de\/gitignore-clear-cache-files\/#primaryimage"},"thumbnailUrl":"https:\/\/blog.nevercodealone.de\/wp-content\/uploads\/2020\/01\/gitignore-clear-cache.jpg","datePublished":"2020-01-22T00:01:17+00:00","dateModified":"2020-03-08T23:11:48+00:00","description":"Bei einem .gitignore clear cache kann man einzelne Files l\u00f6schen oder ganzen Git Ignore Index neu einlesen HowTo Tutorial als PHP Training","breadcrumb":{"@id":"https:\/\/blog.nevercodealone.de\/gitignore-clear-cache-files\/#breadcrumb"},"inLanguage":"de","potentialAction":[{"@type":"ReadAction","target":["https:\/\/blog.nevercodealone.de\/gitignore-clear-cache-files\/"]}]},{"@type":"ImageObject","inLanguage":"de","@id":"https:\/\/blog.nevercodealone.de\/gitignore-clear-cache-files\/#primaryimage","url":"https:\/\/blog.nevercodealone.de\/wp-content\/uploads\/2020\/01\/gitignore-clear-cache.jpg","contentUrl":"https:\/\/blog.nevercodealone.de\/wp-content\/uploads\/2020\/01\/gitignore-clear-cache.jpg","width":1024,"height":512,"caption":".gitignore clear-cache"},{"@type":"BreadcrumbList","@id":"https:\/\/blog.nevercodealone.de\/gitignore-clear-cache-files\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Startseite","item":"https:\/\/blog.nevercodealone.de\/"},{"@type":"ListItem","position":2,"name":".gitignore clear cache files Linux Command Line"}]},{"@type":"WebSite","@id":"https:\/\/blog.nevercodealone.de\/#website","url":"https:\/\/blog.nevercodealone.de\/","name":"Employer Branding und PHP Training","description":"Employer Branding f\u00fcr Web Development Jobs, viele Tutorials und HowTo Gastbeitr\u00e4ge der Community","publisher":{"@id":"https:\/\/blog.nevercodealone.de\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/blog.nevercodealone.de\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"de"},{"@type":"Organization","@id":"https:\/\/blog.nevercodealone.de\/#organization","name":"Never Code Alone","url":"https:\/\/blog.nevercodealone.de\/","logo":{"@type":"ImageObject","inLanguage":"de","@id":"https:\/\/blog.nevercodealone.de\/#\/schema\/logo\/image\/","url":"https:\/\/blog.nevercodealone.de\/wp-content\/uploads\/2016\/03\/nca_2.png","contentUrl":"https:\/\/blog.nevercodealone.de\/wp-content\/uploads\/2016\/03\/nca_2.png","width":212,"height":130,"caption":"Never Code Alone"},"image":{"@id":"https:\/\/blog.nevercodealone.de\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/nevercodealone\/","https:\/\/x.com\/nevercodealone","https:\/\/www.instagram.com\/nevercodealone\/","https:\/\/www.youtube.com\/c\/NeverCodeAlone"]},{"@type":"Person","@id":"https:\/\/blog.nevercodealone.de\/#\/schema\/person\/abb634fbea84896d032351009372debb","name":"Roland Golla","image":{"@type":"ImageObject","inLanguage":"de","@id":"https:\/\/blog.nevercodealone.de\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/f142b13f7d2f172e4d961904f43cfbbee9cdb799ea5325fe8dbf25f3cc9767f2?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/f142b13f7d2f172e4d961904f43cfbbee9cdb799ea5325fe8dbf25f3cc9767f2?s=96&d=mm&r=g","caption":"Roland Golla"},"description":"Initiator von Never Code Alone, PHP-Trainer und Consultant f\u00fcr Softwarequalit\u00e4t rolandgolla.de - Das PHP-Training gibt es hier","sameAs":["http:\/\/www.rolandgolla.de","https:\/\/www.facebook.com\/roland.golla","https:\/\/www.linkedin.com\/in\/rolandgolla","https:\/\/x.com\/https:\/\/twitter.com\/cleancode_devel"],"url":"https:\/\/blog.nevercodealone.de\/author\/rolandgolla\/"}]}},"_links":{"self":[{"href":"https:\/\/blog.nevercodealone.de\/wp-json\/wp\/v2\/posts\/6865","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blog.nevercodealone.de\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.nevercodealone.de\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.nevercodealone.de\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.nevercodealone.de\/wp-json\/wp\/v2\/comments?post=6865"}],"version-history":[{"count":4,"href":"https:\/\/blog.nevercodealone.de\/wp-json\/wp\/v2\/posts\/6865\/revisions"}],"predecessor-version":[{"id":7019,"href":"https:\/\/blog.nevercodealone.de\/wp-json\/wp\/v2\/posts\/6865\/revisions\/7019"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/blog.nevercodealone.de\/wp-json\/wp\/v2\/media\/6868"}],"wp:attachment":[{"href":"https:\/\/blog.nevercodealone.de\/wp-json\/wp\/v2\/media?parent=6865"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.nevercodealone.de\/wp-json\/wp\/v2\/categories?post=6865"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.nevercodealone.de\/wp-json\/wp\/v2\/tags?post=6865"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}