Unified Diff Viewer
Paste a git diff or .patch file and read it as a coloured, per-file view with old and new line numbers and added and removed line counts.
Free · No sign-up · Your inputs stay in your browser
Input
Render a unified diff
2 files, +7 −3
| @@ -12,9 +12,13 @@ class LoginController extends Controller | |||
| 12 | 12 | public function store(Request $request) | |
| 13 | 13 | { | |
| 14 | − | $credentials = $request->only('email', 'password'); | |
| 14 | + | $credentials = $request->validate([ | |
| 15 | + | 'email' => ['required', 'email'], | |
| 16 | + | 'password' => ['required'], | |
| 17 | + | ]); | |
| 15 | 18 | ||
| 16 | 19 | if (Auth::attempt($credentials)) { | |
| 17 | − | return redirect('/home'); | |
| 20 | + | $request->session()->regenerate(); | |
| 21 | + | return redirect()->intended('/home'); | |
| 18 | 22 | } |
| @@ -3,3 +3,3 @@ | |||
| 3 | − | Route::post('/login', [LoginController::class, 'store']); | |
| 3 | + | Route::post('/login', [LoginController::class, 'store'])->middleware('throttle:login'); |
Parsed from the unified format: each @@ hunk header gives the starting line in the old and new file, and the line numbers count on from there. Apply a patch with git apply --check first, then git apply; for a patch made with git format-patch, git am keeps the author and message. Runs in this browser; nothing you paste is sent anywhere.
About this tool
Method, assumptions, practical next steps, and limits.
Reading a hunk header
@@ -12,9 +12,13 @@ means the hunk starts at line 12 and spans 9 lines in the old file, and starts at line 12 and spans 13 in the new one. Text after the second @@ is the enclosing function or class, which Git finds with its diff driver. The format is described in the git diff documentation.
Applying a patch
git apply --check file.patch reports whether it applies cleanly without changing anything; git apply then applies it. Patches made with git format-patch carry the author and message and are applied with git am.