diff --git a/src/init.rs b/src/init.rs
index a24a38183c4b042edb8ebe66aa78637a5a8eaca3..cead23077b8ba0de53594cfdc3e5a8d2d46c574b 100644
--- a/src/init.rs
+++ b/src/init.rs
@@ -1,5 +1,6 @@
 use std::path::PathBuf;
 use std::process::{exit, Command};
+use crate::create_hooks;
 
 /// Function used to get borg repository folder and results repository only if 
 /// the project is inside a git repository
@@ -40,7 +41,7 @@ pub fn get_borg_folder() -> (PathBuf, PathBuf) {
 }
 
 /// Creation of a borg repository in the same directory as the .git repository
-pub fn init_repository() {
+fn init_repository() {
     let (borg_path, _) = get_borg_folder();
     let output = Command::new("borg")
         .arg("init")
@@ -65,3 +66,16 @@ pub fn init_repository() {
         }
     }
 }
+
+
+/// Creation of a borg repository and creation of hooks if needed inside `.git/hooks`
+/// folder
+/// # Arguments:
+/// * `hooks`: a boolean indicating wether or not to create hooks
+/// * `compression`: The compression used automatically after each commit. This parameter is only used if hooks is true.
+pub fn init_and_hook(hooks: bool, compression: &str) {
+    init_repository();
+    if hooks {
+        create_hooks::create_hooks(compression);
+    }
+}
\ No newline at end of file