Skip to the content.

Working with the Repository

Contents

Repository work is optional for firmware users. For installation and first use follow the UM. OpenCommit below is an optional contributor tool, not a Trice prerequisite.

Action Command
Get a local repository copy. git clone github.com/rokath/trice.git trice
Show current folder pwd
Show repository status. git status
Clean the repo, if needed. git stash push
Show all branches. git branch -a
Switch to main. git switch main
Fetch a pull request as new branch PRIDa. git fetch origin pull/ID/head:PRIDa
List worktree. git worktree list
Add to worktree. git worktree add ../trice_wt_PRIDa PRIDa
Add branch dev to worktree git worktree add ../trice-dev dev
Rstore the repo if needed. git stash pop
Change to new folder. cd ../trice_wt_PRIDa
Show repository status. git status
Test pull request. ./scripts/testAll.sh full
Show repository status. git status
Clean pull request. git restore .
Change to previous folder. cd -
Delete worktree branch. git worktree remove ../trice_wt_PRIDa
Delete git branch. git branch -d PRIDa
Log last 3 commits in branch maste git log -3 main
Checkout by hash git checkout <hash>
One Liner Log until shortly before v1.0.0 git log --graph --decorate --all --pretty=format:'%C(bold yellow)%h%Creset %C(bold green)%ad%Creset %C(bold cyan)%d%Creset %C(white)%s%Creset' --date=format:'%Y-%m-%d %H:%M' --since 2025-04-01
One Liner Log for branch devel git log --graph --decorate devel --pretty=format:'%C(bold yellow)%h%Creset %C(bold green)%ad%Creset %C(bold cyan)%d%Creset %C(white)%s%Creset' --date=format:'%Y-%m-%d %H:%M'
One Liner Log with author git log --graph --decorate --all --pretty=format:'%C(bold yellow)%h%Creset %C(bold green)%ad%Creset %C(bold blue)%an%Creset %C(bold cyan)%d%Creset %C(white)%s%Creset' --date=format:'%Y-%m-%d %H:%M'
New worktree detached branch for compare git worktree add --detach ../trice_9995fdc4b 9995fdc4b
Add a special commit worktree ./AddWorktreeFromGitLogLineData.sh <commit-hash> <YYYY-MM-DD> <HH:MM>
Create a bunch of worktrees ./AddWorktreesBetween.sh "<since-date>" "<until-date>" or ./AddWorktreesBetween.sh <older-hash> <newer-hash>
Delete all trice_* worktrees cd ~/repos && rm trice_* && cd trice && git worktree prune && git worktree list
Delete all trice_* branches git branch -D `git branch \| grep -E 'trice_'`
Show all opencommit parameter oco config describe
Show some config settings oco config get OCO_MODEL && oco config get OCO_PROMPT_MODULE && oco config get OCO_EMOJI

1. Install opencommit on macOS


1.1. Prerequisites

Before you begin, make sure you have:


1.2. Step 1 — Get Your OpenAI API Key


1.3. Step 2 — Install OpenCommit


1.4. Step 3 — Set Up Your API Key on macOS


1.5. Step 4 — Optional Configuration

export OCO_LANG="en"           # or "de", "fr", etc.
export OCO_MODEL="gpt-5"       # or another model like "gpt-4-turbo"
export OCO_PROMPT_MODULE="conventional"
export OCO_EMOJI=true

Add these to your ~/.zshrc for persistence.


1.6. Step 5 — Use OpenCommit


1.7. Step 6 — (Optional) Install Git Hook


1.8. Step 7 — Troubleshooting

If OpenCommit says:


2. Install opencommit on Windows

2.1. Overview

OpenCommit is a tool that uses AI (like GPT models) to automatically generate meaningful Git commit messages based on your code changes.

This guide explains how to install and configure OpenCommit on Windows step by step.


2.2. Prerequisites


2.3. Installation Steps

1. Install OpenCommit Globally

2. Configure the API Key

3. (Optional) Configure Defaults


2.4. Usage

2.5. Troubleshooting


2.6. Example

git add .
oco

Output:

Generated commit message:
...

3. Fork It (get a contributor)

If you wish to get a contributor please fork the Trice repository.

3.1. What “forking” means

Forking creates your own copy of someone else’s repository under your account. You can then:

3.2. How to Fork (GitHub)

1. Go to the repository you want to fork

Example: https://github.com/rokath/trice

2. Click the **“Fork” button (top-right)**

You’ll be taken to a Create Fork page.

3. Choose options (usually leave defaults)

Click Create Fork.

4. Clone your fork locally

git clone https://github.com/YOUR_USERNAME/trice.git && cd trice

5. (Optional but recommended) Add the original repo as upstream

This lets you pull updates later.

git remote add upstream https://github.com/rokath/trice.git

Check remotes:

git remote -v

6. Keep your fork updated

Run git fetch upstream, then git merge upstream/main on the branch you want to update.

Or:

git pull upstream main

4. Clone It

1. Make sure Git is installed

Check with:

git --version

If not installed, download from https://git-scm.com

2. Clone the repository

Run this command in your terminal or command prompt:

git clone https://github.com/rokath/trice.git

This creates a local folder named trice with the full project history.

3. (Optional) Enter the project folder

cd trice