Skip to content

lviggiani/deno-fluent-git

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Deno Fluent Git

Simple Git bindings for Deno. Uses native git commands rather than libgit2 direct binding

Very early stage

Requirements

git 2.x

Example

Create a repository, add file and commit

// Create and init repo
const dir = await Deno.makeTempDir();
const repo = await Repo.init(dir);

// Put some content
await Deno.writeTextFile(join(dir, "test-file.txt"), "Some test file");
let status = await repo.getStatus();
console.log(status); // => untracked: ["test-file.txt"]

// Stage all files
await repo.addAll();
status = await repo.getStatus(); // => untracked:[], added: ["test-file.txt"]

// Commit failure (author is missing)
let commitInfo = await repo.commit("First test commit").catch(() => undefined);
console.log(commitInfo); // => undefined

// Set author and try again
repo.author = new GitAuthor("John Smith", "[email protected]");
commitInfo = await repo.commit("First test commit");
console.log(commitInfo); // => latest commit information is shown

// cleanup
await Deno.remove(dir, { recursive: true });

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published