<?xml version="1.0" encoding="UTF-8"?> <rss
version="2.0"
xmlns:content="http://purl.org/rss/1.0/modules/content/"
xmlns:wfw="http://wellformedweb.org/CommentAPI/"
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:atom="http://www.w3.org/2005/Atom"
xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
> <channel><title>Autarchy of the Private Cave &#187; remove</title> <atom:link href="https://bogdan.org.ua/tags/remove/feed" rel="self" type="application/rss+xml" /><link>https://bogdan.org.ua</link> <description>Tiny bits of bioinformatics, [web-]programming etc</description> <lastBuildDate>Wed, 28 Dec 2022 16:09:04 +0000</lastBuildDate> <language>en-US</language> <sy:updatePeriod>hourly</sy:updatePeriod> <sy:updateFrequency>1</sy:updateFrequency> <generator>https://wordpress.org/?v=3.8.27</generator> <item><title>Linux: how to remove trailing ^M (carriage return)</title><link>https://bogdan.org.ua/2009/03/30/linux-how-to-remove-trailing-control-m-carriage-return.html</link> <comments>https://bogdan.org.ua/2009/03/30/linux-how-to-remove-trailing-control-m-carriage-return.html#comments</comments> <pubDate>Mon, 30 Mar 2009 09:43:11 +0000</pubDate> <dc:creator><![CDATA[Bogdan]]></dc:creator> <category><![CDATA[*nix]]></category> <category><![CDATA[how-to]]></category> <category><![CDATA[Notepad]]></category> <category><![CDATA[carriage return]]></category> <category><![CDATA[files]]></category> <category><![CDATA[linux]]></category> <category><![CDATA[multiple]]></category> <category><![CDATA[remove]]></category> <category><![CDATA[trailing space]]></category> <guid
isPermaLink="false">http://bogdan.org.ua/?p=640</guid> <description><![CDATA[Imagine you have some styles.css transferred from Win machine to Linux via FTP in binary mode instead of ASCII mode; then cat styles.css &#124; tr -d &#34;\r&#34; > styles-nocarriage.css will create styles-nocarriage.css with ^M&#8217;s removed. Alternative syntax: tr -d &#34;\r&#34; < styles.css > styles-nocarriage.css Most editors have global replace features which allow to get rid [&#8230;]]]></description> <content:encoded><![CDATA[<p>Imagine you have some <strong>styles.css</strong> transferred from Win machine to Linux via FTP in binary mode instead of ASCII mode; then</p><blockquote><p>cat styles.css | tr -d &quot;\r&quot; > styles-nocarriage.css</p></blockquote><p>will create<strong> styles-nocarriage.css</strong> with ^M&#8217;s removed.</p><p>Alternative syntax:</p><blockquote><p>tr -d &quot;\r&quot; < styles.css > styles-nocarriage.css</p></blockquote><p>Most editors have global replace features which allow to get rid of control characters using regular expressions (exact instructions are editor-specific).</p><p>For <strong>multiple files</strong>, try this:</p><blockquote><p> for f<br
/> do<br
/> mv $f ${f}~ &amp;&amp; tr -d &quot;\r&quot; <${f}~ >$f<br
/> rm ${f}~<br
/> done</p></blockquote><p>Save this shell script as a file (e.g. <strong>dos2unix.sh</strong>), then do <strong>./dos2unix.sh</strong> <em><filename(s)></em>. This script accepts wildcards (e.g. <strong>./dos2unix.sh *.php</strong>), so be careful!</p><p><a
class="a2a_button_citeulike" href="https://www.addtoany.com/add_to/citeulike?linkurl=https%3A%2F%2Fbogdan.org.ua%2F2009%2F03%2F30%2Flinux-how-to-remove-trailing-control-m-carriage-return.html&amp;linkname=Linux%3A%20how%20to%20remove%20trailing%20%5EM%20%28carriage%20return%29" title="CiteULike" rel="nofollow noopener" target="_blank"></a><a
class="a2a_button_pocket" href="https://www.addtoany.com/add_to/pocket?linkurl=https%3A%2F%2Fbogdan.org.ua%2F2009%2F03%2F30%2Flinux-how-to-remove-trailing-control-m-carriage-return.html&amp;linkname=Linux%3A%20how%20to%20remove%20trailing%20%5EM%20%28carriage%20return%29" title="Pocket" rel="nofollow noopener" target="_blank"></a><a
class="a2a_button_kindle_it" href="https://www.addtoany.com/add_to/kindle_it?linkurl=https%3A%2F%2Fbogdan.org.ua%2F2009%2F03%2F30%2Flinux-how-to-remove-trailing-control-m-carriage-return.html&amp;linkname=Linux%3A%20how%20to%20remove%20trailing%20%5EM%20%28carriage%20return%29" title="Kindle It" rel="nofollow noopener" target="_blank"></a><a
class="a2a_button_evernote" href="https://www.addtoany.com/add_to/evernote?linkurl=https%3A%2F%2Fbogdan.org.ua%2F2009%2F03%2F30%2Flinux-how-to-remove-trailing-control-m-carriage-return.html&amp;linkname=Linux%3A%20how%20to%20remove%20trailing%20%5EM%20%28carriage%20return%29" title="Evernote" rel="nofollow noopener" target="_blank"></a><a
class="a2a_button_pinterest" href="https://www.addtoany.com/add_to/pinterest?linkurl=https%3A%2F%2Fbogdan.org.ua%2F2009%2F03%2F30%2Flinux-how-to-remove-trailing-control-m-carriage-return.html&amp;linkname=Linux%3A%20how%20to%20remove%20trailing%20%5EM%20%28carriage%20return%29" title="Pinterest" rel="nofollow noopener" target="_blank"></a><a
class="a2a_dd addtoany_share_save addtoany_share" href="https://www.addtoany.com/share#url=https%3A%2F%2Fbogdan.org.ua%2F2009%2F03%2F30%2Flinux-how-to-remove-trailing-control-m-carriage-return.html&#038;title=Linux%3A%20how%20to%20remove%20trailing%20%5EM%20%28carriage%20return%29" data-a2a-url="https://bogdan.org.ua/2009/03/30/linux-how-to-remove-trailing-control-m-carriage-return.html" data-a2a-title="Linux: how to remove trailing ^M (carriage return)"><img
src="https://static.addtoany.com/buttons/share_save_120_16.png" alt="Share"></a></p>]]></content:encoded> <wfw:commentRss>https://bogdan.org.ua/2009/03/30/linux-how-to-remove-trailing-control-m-carriage-return.html/feed</wfw:commentRss> <slash:comments>3</slash:comments> </item> <item><title>Git: how to remove file and commit from history</title><link>https://bogdan.org.ua/2009/02/13/git-how-to-remove-file-commit-from-history.html</link> <comments>https://bogdan.org.ua/2009/02/13/git-how-to-remove-file-commit-from-history.html#comments</comments> <pubDate>Fri, 13 Feb 2009 19:21:32 +0000</pubDate> <dc:creator><![CDATA[Bogdan]]></dc:creator> <category><![CDATA[how-to]]></category> <category><![CDATA[Links]]></category> <category><![CDATA[Programming]]></category> <category><![CDATA[file]]></category> <category><![CDATA[git]]></category> <category><![CDATA[history]]></category> <category><![CDATA[remove]]></category> <category><![CDATA[repository]]></category> <guid
isPermaLink="false">http://bogdan.org.ua/?p=590</guid> <description><![CDATA[Once I accidentally added circa 300 MiB of archive files to one of my git repositories (which was as small as 5 MiB). I removed those files as soon as I noticed them, but the .git directory still preserved commits with those files, and still occupied over 300 MiB. I have found the solution at [&#8230;]]]></description> <content:encoded><![CDATA[<p>Once I accidentally added circa 300 MiB of archive files to one of my git repositories (which was as small as 5 MiB). I removed those files as soon as I noticed them, but the .git directory still preserved commits with those files, and still occupied over 300 MiB.</p><p>I have found the <a
href="http://stackoverflow.com/questions/307828/git-remove-file-accidentally-added-to-the-repository">solution</a> at <a
href="http://stackoverflow.com/">stackoverflow</a> (see also this <a
href="http://stackoverflow.com/questions/250238/collapsing-a-git-repositorys-history">question</a>).</p><p>This method worked for me, but I couldn&#8217;t push my rebased repository to the gitosis. I would need to re-init the gitosis repository from my rebased, but I&#8217;m not yet prepared to do that.</p><p>There is also a slightly different method (which relies on a temporary tag instead of a temporary branch), documented in Git online manual pages; I prefer the temporary branch method.</p><p>Below is a full copy-paste of the winning answer by Charles Bailey:</p><blockquote><p> # create and check out a temporary branch at the location of the bad merge<br
/> git checkout -b tmpfix <sha1-of-bad-merge-or-commit></p><p># remove the incorrectly added file<br
/> git rm somefile.orig</p><p># commit the amended merge<br
/> git commit &#8211;amend</p><p># go back to the master branch<br
/> git checkout master</p><p># replant the master branch onto the corrected merge<br
/> git rebase tmpfix</p><p># delete the temporary branch<br
/> git branch -d tmpfix</p></blockquote><p>Also, in my case <a
href="http://stackoverflow.com/questions/495345/git-removing-selected-commits-from-repository">this thread</a> at stackoverflow was highly useful. I start enjoying the concise and compact style of Charles Bailey <img
src="https://bogdan.org.ua/wp-includes/images/smilies/icon_smile.gif" alt=":)" class="wp-smiley" /> :<br
/> <span
id="more-590"></span></p><blockquote><p> # detach head and move to D commit<br
/> git checkout <SHA1-for-D></p><p># move HEAD to A, but leave the index and working tree as for D<br
/> git reset &#8211;soft <SHA1-for-A></p><p># Redo the D commit re-using the commit message, but now on top of A<br
/> git commit -C <SHA1-for-D></p><p># Re-apply everything from the old D onwards onto this new place<br
/> git rebase &#8211;onto HEAD <SHA1-for-D> master</p></blockquote><p>Note: this example is for a branch of commits R&#8211;A&#8211;B&#8211;C&#8211;D&#8211;E&#8211;HEAD, where commits B &#038; C should be removed from commit history.</p><p>Another option is to use git rebase &#8211;interactive (for the same example):</p><blockquote><p> git rebase -i HEAD~5</p></blockquote><p>Unfortunately, rebasing on a public (pushed out) branch has no effect for other users of the current gitosis repository.</p><p>An alternative to re-initializing gitosis repository from rebased scratch could be switching to a different (rebased) branch, and deleting the outdated master branch; but I haven&#8217;t investigated if this works.</p><p><a
class="a2a_button_citeulike" href="https://www.addtoany.com/add_to/citeulike?linkurl=https%3A%2F%2Fbogdan.org.ua%2F2009%2F02%2F13%2Fgit-how-to-remove-file-commit-from-history.html&amp;linkname=Git%3A%20how%20to%20remove%20file%20and%20commit%20from%20history" title="CiteULike" rel="nofollow noopener" target="_blank"></a><a
class="a2a_button_pocket" href="https://www.addtoany.com/add_to/pocket?linkurl=https%3A%2F%2Fbogdan.org.ua%2F2009%2F02%2F13%2Fgit-how-to-remove-file-commit-from-history.html&amp;linkname=Git%3A%20how%20to%20remove%20file%20and%20commit%20from%20history" title="Pocket" rel="nofollow noopener" target="_blank"></a><a
class="a2a_button_kindle_it" href="https://www.addtoany.com/add_to/kindle_it?linkurl=https%3A%2F%2Fbogdan.org.ua%2F2009%2F02%2F13%2Fgit-how-to-remove-file-commit-from-history.html&amp;linkname=Git%3A%20how%20to%20remove%20file%20and%20commit%20from%20history" title="Kindle It" rel="nofollow noopener" target="_blank"></a><a
class="a2a_button_evernote" href="https://www.addtoany.com/add_to/evernote?linkurl=https%3A%2F%2Fbogdan.org.ua%2F2009%2F02%2F13%2Fgit-how-to-remove-file-commit-from-history.html&amp;linkname=Git%3A%20how%20to%20remove%20file%20and%20commit%20from%20history" title="Evernote" rel="nofollow noopener" target="_blank"></a><a
class="a2a_button_pinterest" href="https://www.addtoany.com/add_to/pinterest?linkurl=https%3A%2F%2Fbogdan.org.ua%2F2009%2F02%2F13%2Fgit-how-to-remove-file-commit-from-history.html&amp;linkname=Git%3A%20how%20to%20remove%20file%20and%20commit%20from%20history" title="Pinterest" rel="nofollow noopener" target="_blank"></a><a
class="a2a_dd addtoany_share_save addtoany_share" href="https://www.addtoany.com/share#url=https%3A%2F%2Fbogdan.org.ua%2F2009%2F02%2F13%2Fgit-how-to-remove-file-commit-from-history.html&#038;title=Git%3A%20how%20to%20remove%20file%20and%20commit%20from%20history" data-a2a-url="https://bogdan.org.ua/2009/02/13/git-how-to-remove-file-commit-from-history.html" data-a2a-title="Git: how to remove file and commit from history"><img
src="https://static.addtoany.com/buttons/share_save_120_16.png" alt="Share"></a></p>]]></content:encoded> <wfw:commentRss>https://bogdan.org.ua/2009/02/13/git-how-to-remove-file-commit-from-history.html/feed</wfw:commentRss> <slash:comments>2</slash:comments> </item> </channel> </rss>