pub fn squash_to_single_commit(&self, msg: &str) -> anyhow::Result<()> {
        let tree = self.repository.find_commit(self.head_oid()?)?.tree()?;
        let sig = self.repository.signature()?;

        // We cannot update an existing `update_ref`, because that requires the
        // first parent of this commit to match the ref's current value.
        // Instead, create the commit and then do a hard reset.
        let commit = self.repository.commit(None, &sig, &sig, msg, &tree, &[])?;
        let commit = self
            .repository
            .find_object(commit, Some(git2::ObjectType::Commit))?;
        self.repository
            .reset(&commit, git2::ResetType::Hard, None)?;

        Ok(())
    }
/// Reset `HEAD` to a single commit with all the index contents, but no parent
Reset `HEAD` to a single commit with all the index contents, but no parent
Reset ` HEAD ` to a single commit with all the index contents but no parent
pub fn squash_to_single_commit(&self, msg: &str) -> anyhow::Result<()> {
        let tree = self.repository.find_commit(self.head_oid()?)?.tree()?;
        let sig = self.repository.signature()?;
        // We cannot update an existing `update_ref`, because that requires the
        // first parent of this commit to match the ref's current value.
        // Instead, create the commit and then do a hard reset.
        let commit = self.repository.commit(None, &sig, &sig, msg, &tree, &[])?;
        let commit = self
            .repository
            .find_object(commit, Some(git2::ObjectType::Commit))?;
        self.repository
            .reset(&commit, git2::ResetType::Hard, None)?;
        Ok(())
    }
pub fn squash_to_single_commit ( & self , msg : & str ) -> anyhow :: Result < ( ) > { let tree = self . repository . find_commit ( self . head_oid ( ) ? ) ? . tree ( ) ? ; let sig = self . repository . signature ( ) ? ; // We cannot update an existing `update_ref`, because that requires the // first parent of this commit to match the ref's current value. // Instead, create the commit and then do a hard reset. let commit = self . repository . commit ( None , & sig , & sig , msg , & tree , & [ ] ) ? ; let commit = self . repository . find_object ( commit , Some ( git2 :: ObjectType :: Commit ) ) ? ; self . repository . reset ( & commit , git2 :: ResetType :: Hard , None ) ? ; Ok ( ( ) ) }
Reset `HEAD` to a single commit with all the index contents, but no parent
Reset ` HEAD ` to a single commit with all the index contents but no parent
&self
msg
&str