An in-memory Git simulator built in pure JavaScript. my-git implements a Directed Acyclic Graph (DAG) to accurately simulate Git's internal mechanics, handling core version control operations entirely in memory.
- In-Memory DAG: Utilizes a Directed Acyclic Graph to represent commit history and references.
- Commits: Create standard commit objects.
- Branching: Create, delete, and switch branches effortlessly.
- 3-Way Merging: Implements full 3-way merge logic between branches.
- Rebasing: Rebase branches onto new base commits, rewriting history just like the real Git.
Git.js: The core implementation of the Git simulator and the entry point for the application.Git.test.js: The test suite verifying the behavior of the DAG, branching, merging, and rebasing.
- Node.js installed on your machine.
Clone the repository and navigate to the project directory:
git clone <repository-url>
cd my-git
npm installTo verify that the simulator is working correctly, you can run the test suite:
npm testThis will execute the Git.test.js file and output the test results to the console.
const Git = require('./Git');
// Initialize a new Git instance
const repo = new Git();
// Example usage to be expanded based on your implementation