This is the procedure used by pro's to contribute to a git workflow.
Everything in Git has a branch so just think one branch is allocated to a user. eg: wsl and awk are two users here and main is the parent branch. Both will work on their laptops throughout the day.
Branches
| Who | Branch | Machine |
|---|---|---|
| wsl | wsl | WSL machine |
| awk | cp-01 | k3s-cp-01 node |
| shared | main | PRs only, never push direc |
Branch Switching
# to check which branch you are on (* = current)
git branch
# to see all branch on the git system
git branch -a
# switch to your branch
git checkout wsl # awk on WSL
git checkout cp-01 # awk on k3s-cp-01
# create a new branch (only if it doesn't exist yet)
git checkout -b newbranch
# delete a branch (accidental ones)
git branch -d branchnameFirst Time Only — New Dev Setup
So we walk into a job that uses git so the first thing we do is to clone the remote repo on the github etc to our local laptop
# clone the repo
mkdir homelab
cd homelab
git clone http://172.16.77.10:30040/awk/homelab .
# switch to YOUR branch
git checkout wsl # awk uses: wsl | mel uses: melEvery Morning
A developer starts work so the first task he runs is pull the branch he is the owner eg: wsl here.# sync your own branch first git pull origin wsl
The immediate step then is to grab anything in the main repo to his wsl folder to ensure main repo is in sync with his wsl..
# grab anything merged into main overnight git pull origin main
During The Day
He writes codes all day and makes changes as he likes between 9-5 pm
# edit yaml files, helm charts, configs...Every Evening
Before going home, he will ensure he runs git push origin wsl to sync all his files to the github wsl branch .
# check what you changed
git status
# stage all changes
git add .
# commit with a meaningful message
git commit -m "add nginx ingress for homarr"
# push to Gitea
git push origin wslWhen Ready — Merge Into Main via PR
This is the section which merges all these folders together. So many developers will be writing code and each will be pushing it to their own branch so now we need to merge wsl to the main or master repo. One main developer will ensure they merge it..
Go to http://forjeo.ash.local:30040/awk/homelab

Click Pull Requests → New Pull Request
Set: merge into: awk:main ← pull from: awk:wsl
Add title and description → click Create Pull Request
Other dev reviews and approves so Click Create Merge Commit → done!

Commit Message Examples
git commit -m "add homarr ingress and resource limits"
Restore Deleted Files
# accidentally deleted something? no panic
git restore . # restore everything
git restore README.md # restore specific file(Visited 12 times, 1 visits today)

