A lightweight implementation of Git fundamentals in C#, designed for educational purposes. This project demonstrates the core concepts of Git's internal workings while providing basic GitHub integration.
demogit.mp4
-
Basic Git Operations
- Repository initialization and removal
- File staging and unstaging
- Commit creation
- Status checking
- GitHub integration (push and clone)
-
Low-Level Git Operations
- Object hashing
- Tree manipulation
- Object content inspection
- Index management
- .NET 6.0 or higher
- GitHub account (for remote operations)
- GitHub Personal Access Token (for push/clone operations)
- Clone the repository:
git clone https://github.com/yourusername/demogit.git
- Build the project:
cd demogit
dotnet build
demogit init
demogit add <filename> # Add specific file
demogit add . # Add all files
demogit status
demogit commit "Your commit message"
demogit push <github-token> <repository-name>
demogit clone <github-token> <repository-url>
demogit cat-file <type|size|content> <hash>
demogit hash-object -w <file>
demogit ls-tree <tree-hash>
demogit write-tree -w <hash>
To use GitHub features (push/clone), you'll need a Personal Access Token:
- Go to GitHub Settings → Developer Settings → Personal Access Tokens
- Generate a new token with 'repo' scope
- Save the token securely
- Use the token in push/clone commands
DemoGit/
├── Program.cs # Main program entry
├── DemoGitCommands.cs # Command implementations
├── DemoGitHelper.cs # Utility functions
└── Models/
└── TreeEntry.cs # Tree entry model
- Uses SHA-1 for object hashing
- Implements basic Git object types (blob, tree, commit)
- Includes .gitignore support
- Handles binary and text files
- Supports basic GitHub API integration
- Single branch support (main only)
- No merge functionality
- Basic GitHub integration
- No SSH support
- Limited error recovery
- No diffing functionality
- Fork the repository
- Create your feature branch (
git checkout -b feature/AmazingFeature
) - Commit your changes (
git commit -m 'Add some AmazingFeature'
) - Push to the branch (
git push origin feature/AmazingFeature
) - Open a Pull Request
This project is designed for learning Git's internal mechanisms and should not be used as a replacement for Git in production environments.
This project is licensed under the MIT License - see the LICENSE file for details.
- Inspired by Git's internal design
- Built for educational purposes
- Thanks to the Git community for documentation