/ugit

git implementation in C#

Primary LanguageC#MIT LicenseMIT

.Net Core Build Publish Coverage Status GitHub issues GitHub license GitHub release

What is Ugit ?

ugit is git basic implementation by C# language. Origianlly, it's inspired by Nikita's ugit. It supports the git basic features.

  • ugit add
  • ugit commit
  • ugit tag
  • ugit merge
  • ugit branch
  • ugit push/fetch
  • ...

Besides the local offline command, it also supports remote repository work mode, like GitHub.

Prequirements

  • Dotnet 5/6
  • diff command
    • diff.exe (Windows)
    • diff (*nix)

Component

  • Tindo.Ugit: Ugit core library.
  • Tindo.Ugit.CLI: Ugit client tool
  • Tindo.Ugit.Server: Ugit server.

Features

Basic Operations

  • Initilize an empty repository.
> ugit init
Initialized empty ugit repository in C:\Users\fenga\ugitsample\.ugit
  • Check out the status
> ugit status
On branch master
  • Create file and add to repo
> echo "Hello ugit" > ugit.txt
> ugit status
On branch master

Changes not staged for commit:
new file: ugit.txt

> ugit add .\ugit.txt
> ugit status
On branch master

Changes to be committed:
new file: ugit.txt

> ugit commit -m "add ugit.txt file"
8c97a7f70b724764e607efccf3d7c424585f766e
  • Check out the log
> ugit log
commit 8c97a7f70b724764e607efccf3d7c424585f766e(HEAD,refs\heads\master)

add ugit.txt file
  • Create branch and merge
> ugit branch dev
Branch dev create at 8c97a7f70b
> ugit checkout dev

> echo "Hello dev ugit" > dev.txt
> ugit add .\dev.txt
> ugit commit -m "add dev.txt"
25f1f60dbf3decd6bdb20d8178d68e9ed2b40821

> ugit checkout master
> ugit merge dev
  • Crete Tag
> ugit tag v1.0
> ugit tag
v1.0

Push/Pull remote server

  • Start the Tindo.Ugit.Server and configure the RepositoryDirectory
{
    "UgitServer": {
        "RepositoryDirectory": "C:\\Users\\gaufung\\ugitServerRepos"
    }
}

  • Initilzie the Ugit reposistory in the server

  • Browse repository

  • Clone repository

  • Configure remote
> ugit remote origin "http://localhost:5000/TestRepo"
  • Push and fetch origin
> ugit fetch origin 
> ugit merge remote/master
> "hello ugit" >> world.txt
>> ugit add world.txt
>> ugit commit -m "second commit"
> ugit push origin master

Tutorial

Feature Roadmap

To be honest, as a side project, Ugit has reached its goal at the beginning. The repo will be treated as inactive status. However it still has a to-do list in the air:

  • Full Linux support
  • Database support
  • One-click deployment to public cloud
  • Web API authentication.