Coding With Git
Language Reference · Installation · Contributing · License
Work in progress. This project is in early draft stage. Syntax and semantics are subject to change.
CWG is a programming language where the source code is the git history. Commit messages are statements, branches are control flow blocks, and merges close those blocks. The interpreter walks the commit DAG and executes it as a program.
The goal is to use git as a genuine programming medium. Readable syntax, real execution, built entirely on top of version control primitives.
Concept
| Git construct | Language construct |
|---|---|
git commit -m "..." |
Statement / instruction |
| Branch | Conditional block or loop |
| Merge | Close a block, return to parent scope |
| Tag | Function definition |
cherry-pick |
Function call |
revert |
Exception handler / undo |
git stash |
Push to memory stack |
git stash pop |
Pop from memory stack |
Installation
CWG is published on PyPI. You need Python 3.10+ and Git installed, then:
pip install cwg
This installs the cwg command on your PATH and pulls in the runtime dependency (GitPython). No need to clone the repository to use the language.
Want to work on CWG itself? See CONTRIBUTING.md for the from-source / editable-install workflow.
Quick Start
Write your first program — a git history that prints hello world:
mkdir hello && cd hello
git init
git commit --allow-empty -m "message = 'hello world'"
git commit --allow-empty -m "print(message)"
cwg run .
# output: hello world
cwg run accepts a .cwg script, a local git repo path, or a remote URL (https://…, git@…, ssh://…).
Language Reference
The full syntax and semantics — control flow, scoping, the execution model, functions, exception handling, and more — live in the Language Reference.
A taste of what CWG looks like — a countdown loop, where a branch is the loop body:
git commit -m "i = 10"
git branch while/countdown
git commit -m "while i > 0:"
git commit -m " print(i)"
git commit -m " i = i - 1"
git checkout main
git merge while/countdown
git commit -m "print('blastoff')"
# output: 10 9 8 7 6 5 4 3 2 1 blastoff
Status
This project is a work in progress. See CONTRIBUTING.md for how to get involved.
Metadata
Release files for cwg 0.2.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| cwg-0.2.0.tar.gz | 39.6 kB | Without provenance | Details for cwg-0.2.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| cwg-0.2.0-py3-none-any.whl | Python 3 | none | any | Details for cwg-0.2.0-py3-none-any.whl |
Total release size: 65.5 kB
Release files / cwg-0.2.0.tar.gz
| Download URL | cwg-0.2.0.tar.gz |
|---|---|
| Size | 39.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
8259164412e5f503841279bf8fbc8786f44cff9a0b70159d922b52aee796e833
|
|
BLAKE2b-256 checksum How to use checksums |
f4d6648e2fc0fd2cdfcce5cdc3316460280a4d49ae712c23716f5ad0da03c200
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.14.5
|
Release files / cwg-0.2.0-py3-none-any.whl
| Download URL | cwg-0.2.0-py3-none-any.whl |
|---|---|
| Size | 25.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
bc79371fc983d29336cdfae617ec97fb99df067ed5c2bc9f6894c0cf50abe578
|
|
BLAKE2b-256 checksum How to use checksums |
fee4db9f1fe3b5d5b91572289b24c9f6a9d7a5f4602a457b072e68b0b6f7a8f9
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.14.5
|
Security for cwg 0.2.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.