diff --git a/Cargo.lock b/Cargo.lock
index bb25911e2a..1f25d4a1f9 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -502,6 +502,7 @@ dependencies = [
"serde",
"simplelog",
"syntect",
+ "tempfile",
"textwrap 0.13.4",
"tui",
"unicode-segmentation",
diff --git a/Cargo.toml b/Cargo.toml
index 13a6ebde8f..44a89155d5 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -42,6 +42,7 @@ serde = "1.0"
anyhow = "1.0"
unicode-width = "0.1"
textwrap = "0.13"
+tempfile = "3.2"
unicode-truncate = "0.2"
unicode-segmentation = "1.7"
easy-cast = "0.4"
diff --git a/asyncgit/src/error.rs b/asyncgit/src/error.rs
index a22c9dbda6..4f4a366af4 100644
--- a/asyncgit/src/error.rs
+++ b/asyncgit/src/error.rs
@@ -18,6 +18,12 @@ pub enum Error {
#[error("git: work dir error")]
NoWorkDir,
+ #[error("git: no parent of commit found")]
+ NoParent,
+
+ #[error("git: not on a branch")]
+ NoBranch,
+
#[error("git: uncommitted changes")]
UncommittedChanges,
diff --git a/asyncgit/src/sync/branch/mod.rs b/asyncgit/src/sync/branch/mod.rs
index edfd073067..b32df9d590 100644
--- a/asyncgit/src/sync/branch/mod.rs
+++ b/asyncgit/src/sync/branch/mod.rs
@@ -44,6 +44,32 @@ pub(crate) fn get_branch_name_repo(
Err(Error::NoHead)
}
+/// Gets the current branch the user is on.
+/// Returns none if they are not on a branch
+/// and Err if there was a problem finding the branch
+pub(crate) fn get_cur_branch(
+ repo: &Repository,
+) -> Result