Snipt.net is closing on December 31st, 2016

For more information, please visit this blog post.

snipt

Ctrl+h for KB shortcuts

Bash

View Commit Differences Between Two Branches in Git

git log --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr)%Creset' --abbrev-commit --date=relative BRANCHNAME..OTHERBRANCHNAME
https://snipt.net/embed/7a2b4368acd071c9295f220e4009deb9/
https://snipt.net/raw/7a2b4368acd071c9295f220e4009deb9/
7a2b4368acd071c9295f220e4009deb9
bash
Bash
1
2016-12-03T12:18:52
True
False
False
Jan 07, 2016 at 04:21 PM
/api/public/snipt/143460/
view-commit-differences-between-two-branches-in-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 log --graph --pretty<span class="o">=</span>format:<span class="s1">&#39;%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr)%Creset&#39;</span> --abbrev-commit --date<span class="o">=</span>relative BRANCHNAME..OTHERBRANCHNAME </span></pre></div> </td></tr></table>
branches, commits, diff, git

Bash

diff output from bash commands

$ diff -u <(curl seanomlor.com/demo/asteroids/index.html) <(curl seanomlor.com/demo/snake/index.html)
https://snipt.net/embed/257f895154039f9080e8ed3916e4fd8d/
https://snipt.net/raw/257f895154039f9080e8ed3916e4fd8d/
257f895154039f9080e8ed3916e4fd8d
bash
Bash
2
2016-12-07T04:08:54
True
False
False
Feb 08, 2014 at 01:26 AM
/api/public/snipt/111880/
diff-output-from-bash-commands
<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>$ diff -u &lt;<span class="o">(</span>curl seanomlor.com/demo/asteroids/index.html<span class="o">)</span> &lt;<span class="o">(</span>curl seanomlor.com/demo/snake/index.html<span class="o">)</span> </span></pre></div> </td></tr></table>
bash, curl, diff

Bash

Diff of two directories and generate a patch

#Diff of two dirs and generate a patch.
diff -urPp dir.old/ dir.new/ > newpatch.patch
https://snipt.net/embed/a374ca697edc9fa7331f2882c902a270/
https://snipt.net/raw/a374ca697edc9fa7331f2882c902a270/
a374ca697edc9fa7331f2882c902a270
bash
Bash
2
2016-12-07T00:04:52
True
False
False
Mar 18, 2013 at 04:06 PM
/api/public/snipt/57879/
diff-of-two-directories-and-generate-a-patch
<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="c1">#Diff of two dirs and generate a patch.</span> </span><span id="L-2"><a name="L-2"></a>diff -urPp dir.old/ dir.new/ &gt; newpatch.patch </span></pre></div> </td></tr></table>
diff, patch

Bash

list the files that are different between two directories, excluding directories that match specific patterns

diff --brief -r -x '.git' -x 'tmp' /path/to/dir1 /path/to/dir2
https://snipt.net/embed/d7604b10c6810f373558d66f69df5b98/
https://snipt.net/raw/d7604b10c6810f373558d66f69df5b98/
d7604b10c6810f373558d66f69df5b98
bash
Bash
1
2016-12-01T17:59:23
True
False
True
Aug 06, 2012 at 01:03 PM
/api/public/snipt/45256/
list-the-files-that-are-different-between-two-directories-excluding-directories-that-match-specific-patterns
<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>diff --brief -r -x <span class="s1">&#39;.git&#39;</span> -x <span class="s1">&#39;tmp&#39;</span> /path/to/dir1 /path/to/dir2 </span></pre></div> </td></tr></table>
bash, diff

Bash

Review each SVN version controlled file with meld which has been modified

1
2
3
4
5
svn st | grep '^M' | sed 's/^M       //g;' | xargs -L 1 meld
sed: simpele search and replace
xargs (3): view every file in meld, one at a time (-L 1)

Note: the match may differ: s/^M      //g;
https://snipt.net/embed/ffc7bb31907cdc9c3b1d93dee453fdf3/
https://snipt.net/raw/ffc7bb31907cdc9c3b1d93dee453fdf3/
ffc7bb31907cdc9c3b1d93dee453fdf3
bash
Bash
5
2016-12-06T15:11:59
True
False
False
/api/public/snipt/35937/
review-each-svn-version-controlled-file-which-has-been-modified-with-meld
<table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><a href="#L-1">1</a> <a href="#L-2">2</a> <a href="#L-3">3</a> <a href="#L-4">4</a> <a href="#L-5">5</a></pre></div></td><td class="code"><div class="highlight"><pre><span></span><span id="L-1"><a name="L-1"></a>svn st <span class="p">|</span> grep <span class="s1">&#39;^M&#39;</span> <span class="p">|</span> sed <span class="s1">&#39;s/^M //g;&#39;</span> <span class="p">|</span> xargs -L <span class="m">1</span> meld </span><span id="L-2"><a name="L-2"></a>sed: simpele search and replace </span><span id="L-3"><a name="L-3"></a>xargs <span class="o">(</span>3<span class="o">)</span>: view every file in meld, one at a <span class="nb">time</span> <span class="o">(</span>-L 1<span class="o">)</span> </span><span id="L-4"><a name="L-4"></a> </span><span id="L-5"><a name="L-5"></a>Note: the match may differ: s/^M //g<span class="p">;</span> </span></pre></div> </td></tr></table>
diff, meld, svn

Bash

Diff two directories for different files

diff -rqu /root/dir/ /home/dir/ | sed -rn "/^Only/s/^Only in (.+?): /\1/p"
https://snipt.net/embed/58bc552a3aa2650706a43b5b43ae4ced/
https://snipt.net/raw/58bc552a3aa2650706a43b5b43ae4ced/
58bc552a3aa2650706a43b5b43ae4ced
bash
Bash
1
2016-12-06T06:43:42
True
False
False
/api/public/snipt/13445/
diff-two-directories-for-different-fiels
<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>diff -rqu /root/dir/ /home/dir/ <span class="p">|</span> sed -rn <span class="s2">&quot;/^Only/s/^Only in (.+?): /\1/p&quot;</span> </span></pre></div> </td></tr></table>
diff, directory, wordpress
Copyrighted, illegal, or inappropriate content? Email [email protected].