{"id":109,"date":"2014-04-15T17:46:47","date_gmt":"2014-04-15T17:46:47","guid":{"rendered":"http:\/\/linux.suriyasuneel.com\/?p=109"},"modified":"2015-02-19T19:35:29","modified_gmt":"2015-02-19T19:35:29","slug":"git-trick","status":"publish","type":"post","link":"http:\/\/linux.suriyasuneel.com\/?p=109","title":{"rendered":"Git Remove deleted files en masse"},"content":{"rendered":"<p>When you work with a project sometimes you have to delete a lot of files that you don&#8217;t need anymore.<br \/>\nIf you issue a git status command<\/p>\n<pre>$git status<\/pre>\n<p><img decoding=\"async\" loading=\"lazy\" class=\"alignnone size-full wp-image-112\" style=\"line-height: 1.5em;\" alt=\"Untitled\" src=\"http:\/\/linux.suriyasuneel.com\/wp-content\/uploads\/Untitled.png\" width=\"674\" height=\"387\" \/>it will show the missing files in the red. that means the files are missing from the folder, but they are still in the index.<br \/>\nThe normal process is delete them manually using a gui file manager. Then<\/p>\n<pre>$git rm particular_file\r\n$git commit -a -m \"commit\"<\/pre>\n<p>Now if you check the status, then the deleted file will show up in green as deleted.<br \/>\nSay you deleted close to 10 to 20 files, that means i have to manually remove each of them from the git index.<br \/>\nThe easy way is to issue<\/p>\n<pre>$git add -u<\/pre>\n<p>this will update all the missing files and mark them as deleted.<\/p>\n<p><a href=\"http:\/\/linux.suriyasuneel.com\/wp-content\/uploads\/after_update.png\"><img decoding=\"async\" loading=\"lazy\" class=\"alignnone size-full wp-image-113\" alt=\"after_update\" src=\"http:\/\/linux.suriyasuneel.com\/wp-content\/uploads\/after_update.png\" width=\"676\" height=\"394\" \/><\/a><br \/>\nnow the commit will make sure that they are removed from the index<\/p>\n","protected":false},"excerpt":{"rendered":"<p>When you work with a project sometimes you have to delete a lot of files that you don&#8217;t need anymore. If you issue a git status command $git status it will show the missing files in the red. that means the files are missing from the folder, but they are still in the index. The [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"_links":{"self":[{"href":"http:\/\/linux.suriyasuneel.com\/index.php?rest_route=\/wp\/v2\/posts\/109"}],"collection":[{"href":"http:\/\/linux.suriyasuneel.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/linux.suriyasuneel.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/linux.suriyasuneel.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/linux.suriyasuneel.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=109"}],"version-history":[{"count":4,"href":"http:\/\/linux.suriyasuneel.com\/index.php?rest_route=\/wp\/v2\/posts\/109\/revisions"}],"predecessor-version":[{"id":115,"href":"http:\/\/linux.suriyasuneel.com\/index.php?rest_route=\/wp\/v2\/posts\/109\/revisions\/115"}],"wp:attachment":[{"href":"http:\/\/linux.suriyasuneel.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=109"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/linux.suriyasuneel.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=109"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/linux.suriyasuneel.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=109"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}