DEV Community

Sharing Diffs on Dev.to?

Howdy,
I want to share a diff on Dev.to. How would you go about doing that?
I found a nice service called mergely, but I'm not sure if my shared diffs are writable by all, and anyways they can't be embeded. How would you share your diffs?

Top comments (3)

Collapse
ย 
philnash profile image
Phil Nash โ€ข

You can share diffs using the regular code fences in markdown. Just start the code fence with: three backticks and then diff (I can't escape the backticks to show you ๐Ÿ˜–).

Then it will look something like this:

diff --git a/Gemfile.lock b/Gemfile.lock
index da900f1..a5c96ce 100644
--- a/Gemfile.lock
+++ b/Gemfile.lock
@@ -82,7 +82,7 @@ GEM
       railties (>= 4.1.0, < 6.0)
       responders
       warden (~> 1.2.3)
-    devise-authy (1.10.0)
+    devise-authy (1.9.0)
       authy (>= 2.7.2)
       devise (>= 3.0.0)
     erubi (1.7.1)
Collapse
ย 
bennypowers profile image
Benny Powers ๐Ÿ‡ฎ๐Ÿ‡ฑ๐Ÿ‡จ๐Ÿ‡ฆ โ€ข

That's awesome!

That will work great for simple diffs, but how would I share, say, a whole-file diff, ignoring whitespace?

Collapse
ย 
rhymes profile image
rhymes โ€ข โ€ข Edited

You could use gist: