{"id":516,"date":"2016-09-06T13:54:37","date_gmt":"2016-09-06T08:24:37","guid":{"rendered":"http:\/\/www.cyberaka.com\/?p=516"},"modified":"2016-09-06T13:54:37","modified_gmt":"2016-09-06T08:24:37","slug":"delete-untracked-file-using-git","status":"publish","type":"post","link":"https:\/\/www.cyberaka.com\/?p=516","title":{"rendered":"Delete Untracked File Using Git"},"content":{"rendered":"<p>Sometimes we want to clean out our Git workspace and remove any file which is untracked. A hard reset usually does the job for modified files as shown below:<br \/>\n<code>git reset --hard<\/code><\/p>\n<p>But hard reset doesn&#8217;t fit in case of untracked files. The following command will do the job:<br \/>\n<code>git clean  -d  -fx \"\"<\/code><\/p>\n<p>-x means ignored files are also removed as well as files unknown to git.<\/p>\n<p>-d means remove untracked directories in addition to untracked files.<\/p>\n<p>-f is required to force it to run.<\/p>\n<p>Reference:<br \/>\nhttps:\/\/www.kernel.org\/pub\/software\/scm\/git\/docs\/git-clean.html<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Sometimes we want to clean out our Git workspace and remove any file which is untracked. A hard reset usually does the job for modified files as shown below: git reset &#8211;hard But hard reset doesn&#8217;t fit in case of untracked files. The following command will do the job: git clean -d -fx &#8220;&#8221; -x [&hellip;]<\/p>\n","protected":false},"author":4,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[56],"tags":[],"class_list":["post-516","post","type-post","status-publish","format-standard","hentry","category-git"],"_links":{"self":[{"href":"https:\/\/www.cyberaka.com\/index.php?rest_route=\/wp\/v2\/posts\/516","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.cyberaka.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.cyberaka.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.cyberaka.com\/index.php?rest_route=\/wp\/v2\/users\/4"}],"replies":[{"embeddable":true,"href":"https:\/\/www.cyberaka.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=516"}],"version-history":[{"count":1,"href":"https:\/\/www.cyberaka.com\/index.php?rest_route=\/wp\/v2\/posts\/516\/revisions"}],"predecessor-version":[{"id":517,"href":"https:\/\/www.cyberaka.com\/index.php?rest_route=\/wp\/v2\/posts\/516\/revisions\/517"}],"wp:attachment":[{"href":"https:\/\/www.cyberaka.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=516"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.cyberaka.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=516"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.cyberaka.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=516"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}