diff --git a/.clang-format b/.clang-format
new file mode 100644
index 0000000000000000000000000000000000000000..6facf9c54a719c1b9818dc666307991cad10d77f
--- /dev/null
+++ b/.clang-format
@@ -0,0 +1,19 @@
+---
+# We'll use defaults from the Google style, but with 4 columns indentation.
+BasedOnStyle: Google
+# Never allow single-line functions
+AllowShortFunctionsOnASingleLine: None
+# Put "else" on a new line
+BreakBeforeBraces: Custom
+BraceWrapping:
+    BeforeElse: true
+# Allow lines up to 90 characters
+ColumnLimit: 90
+# Indent each block by 4 spaces
+IndentWidth: 4
+TabWidth: 4
+# Require 1 space before a comment on the same line
+SpacesBeforeTrailingComments: 1
+# Put a space after a cast, e.g. `(void) arg;`
+SpaceAfterCStyleCast: true
+---
diff --git a/.githooks/pre-commit b/.githooks/pre-commit
new file mode 100755
index 0000000000000000000000000000000000000000..dd547755658807c943cfe47a67b73e0cfc127ea3
--- /dev/null
+++ b/.githooks/pre-commit
@@ -0,0 +1,12 @@
+#!/bin/bash
+
+if loc="$(type -p "clang-format")" && [[ -x $loc ]]; then
+    for name in $(git diff --cached --name-only --diff-filter=ACM); do
+        if echo $name | grep -Eq "\.[ch]$"; then
+            echo "Formatting ${name}..."
+            clang-format -i $name
+        fi
+    done
+else
+    echo "You do not have clang-format installed; so, we were unable to unify the formatting in your files."
+fi
diff --git a/src/mm-explicit.c b/src/mm-explicit.c
index 82010aa39a9872c6607b2c44b419d8c19c01891e..962329427286f042f29ef2bf829ae73002ee6d5f 100644
--- a/src/mm-explicit.c
+++ b/src/mm-explicit.c
@@ -6,8 +6,8 @@
 
 #include <stdint.h>
 
-#include "mm.h"
 #include "memlib.h"
+#include "mm.h"
 
 /** The required alignment of heap payloads */
 const size_t ALIGNMENT = 2 * sizeof(size_t);
@@ -54,11 +54,8 @@ static bool is_allocated(block_t *block) {
  */
 static block_t *find_fit(size_t size) {
     // Traverse the blocks in the heap using the implicit list
-    for (
-        block_t *curr = mm_heap_first;
-        mm_heap_last != NULL && curr <= mm_heap_last;
-        curr = (void *) curr + get_size(curr)
-    ) {
+    for (block_t *curr = mm_heap_first; mm_heap_last != NULL && curr <= mm_heap_last;
+         curr = (void *) curr + get_size(curr)) {
         // If the block is free and large enough for the allocation, return it
         if (!is_allocated(curr) && get_size(curr) >= size) {
             return curr;
@@ -72,7 +69,6 @@ static block_t *block_from_payload(void *ptr) {
     return ptr - offsetof(block_t, payload);
 }
 
-
 /**
  * mm_init - Initializes the allocator state
  */
@@ -157,5 +153,4 @@ void *mm_calloc(size_t nmemb, size_t size) {
  * mm_checkheap - So simple, it doesn't need a checker!
  */
 void mm_checkheap(void) {
-
 }
diff --git a/src/mm-implicit.c b/src/mm-implicit.c
index cdd77636353f6d6f2eb6271fec589d6905437c84..1e0d039c6794874b631797c07bc10fcc953fb652 100644
--- a/src/mm-implicit.c
+++ b/src/mm-implicit.c
@@ -7,8 +7,8 @@
 
 #include <stdint.h>
 
-#include "mm.h"
 #include "memlib.h"
+#include "mm.h"
 
 /** The required alignment of heap payloads */
 const size_t ALIGNMENT = 2 * sizeof(size_t);
@@ -55,11 +55,8 @@ static bool is_allocated(block_t *block) {
  */
 static block_t *find_fit(size_t size) {
     // Traverse the blocks in the heap using the implicit list
-    for (
-        block_t *curr = mm_heap_first;
-        mm_heap_last != NULL && curr <= mm_heap_last;
-        curr = (void *) curr + get_size(curr)
-    ) {
+    for (block_t *curr = mm_heap_first; mm_heap_last != NULL && curr <= mm_heap_last;
+         curr = (void *) curr + get_size(curr)) {
         // If the block is free and large enough for the allocation, return it
         if (!is_allocated(curr) && get_size(curr) >= size) {
             return curr;
@@ -73,7 +70,6 @@ static block_t *block_from_payload(void *ptr) {
     return ptr - offsetof(block_t, payload);
 }
 
-
 /**
  * mm_init - Initializes the allocator state
  */
@@ -158,5 +154,4 @@ void *mm_calloc(size_t nmemb, size_t size) {
  * mm_checkheap - So simple, it doesn't need a checker!
  */
 void mm_checkheap(void) {
-
 }