snipt

Ctrl+h for KB shortcuts

Bash

Super Fetch All

#!/bin/bash
find . -maxdepth 1 -type d -exec sh -c '(cd {} && git fetch --all)' ';'
https://snipt.net/embed/2f45b8a3e3d33801765422eae5c71426/
/raw/2f45b8a3e3d33801765422eae5c71426/
2f45b8a3e3d33801765422eae5c71426
bash
Bash
2
2019-07-22T11:11:18
True
False
False
Mar 26, 2014 at 01:35 PM
/api/public/snipt/125030/
super-fetch-all
<table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><a href="#L-1">1</a> <a href="#L-2">2</a></pre></div></td><td class="code"><div class="highlight"><pre><span></span><span id="L-1"><a name="L-1"></a><span class="ch">#!/bin/bash</span> </span><span id="L-2"><a name="L-2"></a>find . -maxdepth <span class="m">1</span> -type d -exec sh -c <span class="s1">&#39;(cd {} &amp;&amp; git fetch --all)&#39;</span> <span class="s1">&#39;;&#39;</span> </span></pre></div> </td></tr></table>

Bash

List all files ignored by git

$ git ls-files --others -i --exclude-standard
https://snipt.net/embed/1174b79ad60ad2822d954cfb447d4f5a/
/raw/1174b79ad60ad2822d954cfb447d4f5a/
1174b79ad60ad2822d954cfb447d4f5a
bash
Bash
1
2019-07-22T12:27:36
True
False
False
Mar 25, 2014 at 03:35 PM
/api/public/snipt/124752/
list-all-files-ignored-by-git
<table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><a href="#L-1">1</a></pre></div></td><td class="code"><div class="highlight"><pre><span></span><span id="L-1"><a name="L-1"></a>$ git ls-files --others -i --exclude-standard </span></pre></div> </td></tr></table>

Bash

Better Git log

git config --global alias.lg "log --color --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr)%C(bold blue)<%an>%Creset' --abbrev-commit"
https://snipt.net/embed/1feea14ac5545403b2027bbe7046b8a0/
/raw/1feea14ac5545403b2027bbe7046b8a0/
1feea14ac5545403b2027bbe7046b8a0
bash
Bash
2
2019-07-20T05:43:21
True
False
False
Feb 24, 2014 at 11:00 AM
/api/public/snipt/116374/
better-git-log
<table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><a href="#L-1">1</a></pre></div></td><td class="code"><div class="highlight"><pre><span></span><span id="L-1"><a name="L-1"></a>git config --global alias.lg <span class="s2">&quot;log --color --graph --pretty=format:&#39;%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr)%C(bold blue)&lt;%an&gt;%Creset&#39; --abbrev-commit&quot;</span> </span></pre></div> </td></tr></table>
bash, git

Bash

replace X with Y in all files in a project using sed

sed -i '' -e 's/X/Y/g' $(find . -type f)
https://snipt.net/embed/c195316a2cdd5d8900d146a160c0aba7/
/raw/c195316a2cdd5d8900d146a160c0aba7/
c195316a2cdd5d8900d146a160c0aba7
bash
Bash
1
2019-07-22T10:28:11
True
False
False
Feb 18, 2014 at 04:52 PM
/api/public/snipt/114908/
replace-x-with-y-in-all-files-in-a-project-using-sed
<table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><a href="#L-1">1</a></pre></div></td><td class="code"><div class="highlight"><pre><span></span><span id="L-1"><a name="L-1"></a>sed -i <span class="s1">&#39;&#39;</span> -e <span class="s1">&#39;s/X/Y/g&#39;</span> <span class="k">$(</span>find . -type f<span class="k">)</span> </span></pre></div> </td></tr></table>
replace, sed

Bash

Get External IP Address

#!/bin/bash
wget -q -O - checkip.dyndns.org|sed -e 's/.*Current IP Address: //' -e 's/<.*$//' 
https://snipt.net/embed/9f871bc6f2b9d0c3cd5a2567088aae5c/
/raw/9f871bc6f2b9d0c3cd5a2567088aae5c/
9f871bc6f2b9d0c3cd5a2567088aae5c
bash
Bash
2
2019-07-22T10:09:53
True
False
False
Dec 09, 2013 at 04:42 PM
/api/public/snipt/99496/
get-external-ip-address
<table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><a href="#L-1">1</a> <a href="#L-2">2</a></pre></div></td><td class="code"><div class="highlight"><pre><span></span><span id="L-1"><a name="L-1"></a><span class="ch">#!/bin/bash</span> </span><span id="L-2"><a name="L-2"></a>wget -q -O - checkip.dyndns.org<span class="p">|</span>sed -e <span class="s1">&#39;s/.*Current IP Address: //&#39;</span> -e <span class="s1">&#39;s/&lt;.*$//&#39;</span> </span></pre></div> </td></tr></table>
address, ip