Skip to content

Git & Gitea Workflow

Simple Git workflow for a small in-house team

Branch strategy

  • Use two main branches:
    • main — always contains the released/working code.
    • develop — integration branch for completed features and QA.
  • Feature work: each developer creates a feature/NAME branch off develop.

Typical flow (per change)

  • git checkout develop; git pull
  • git checkout -b feature/short-desc
  • Make commits locally (small, focused).
  • Push branch: git push -u origin feature/short-desc
  • Create a merge request (PR) in Gitea from feature/short-desc → develop.
  • At least one teammate reviews the PR; reviewer requests changes or approves.
  • After approval and passing any tests, merge PR into develop (use squash or merge commit per your preference).
  • Developer pulls develop: git checkout develop; git pull
  • Releasing to working/production
  • When develop is stable and tested, create a release:
  • git checkout main; git pull
  • git merge –no-ff develop (or create a release branch first if you want)
  • Push main: git push origin main
  • Tag the release: git tag -a vX.Y -m “Release notes”; git push origin vX.Y
  • Optionally: create a short-lived release/* branch to finalize testing before merging to main.

Handling hotfixes

For urgent fixes on released code:

  • git checkout main; git pull
  • git checkout -b hotfix/desc
  • Fix, commit, push, open PR → main, review, merge.
  • Merge hotfix back into develop to keep branches in sync.

Collaboration & etiquette

  • Pull before starting work: git checkout develop; git pull
  • Keep commits small and descriptive.
  • Rebase feature branches onto updated develop before merging to reduce conflicts:
  • git fetch origin; git rebase origin/develop
  • Use PRs in Gitea for code review — require at least one approval before merging.
  • Resolve merge conflicts locally, test, then push.
  • Minimal permissions/automation suggestions
  • Protect main branch (require PR, at least 1 approval).
  • Optional: require CI/tests pass before merge (if you add CI later).
  • Use tags for releases and a simple changelog in the release notes.
  • Quick commands cheat-sheet
  • Start feature: git checkout develop; git pull; git checkout -b feature/name
  • Push feature: git push -u origin feature/name
  • Update feature with latest develop: git fetch origin; git rebase origin/develop
  • Merge feature in Gitea via PR → develop
  • Release: git checkout main; git merge –no-ff develop; git push; git tag -a vX.Y; git push –tags

This keeps main always deployable, develop for integration/testing, and feature branches for isolated work — simple and safe for a 3-person intranet team.*

!!! note “A basic question:” We have one main branch on our Gitea server. What is the best way to create a development branch from that main. On the client machine thast pushed up the main, on any client that can login to Gitea, or on gitea loged in as the repository owner?

Step by step How-To

Create the develop branch on whichever environment is easiest and most convenient — both server-side (Gitea web UI) and client-side (local git) are fine. Recommended simple options:

Option A — Create on the server (Gitea web UI)

Pros: instantly visible to everyone, no local checkout required.

Steps:

  • In Gitea, open the repo → Branches → New branch.

  • Choose base: main, name: develop, create.

  • After creation, each developer runs:

git fetch origin
git checkout develop
git pull

Option B — Create from a client machine (common workflow)

Pros: you can start working immediately, create initial commits if desired.

Steps (on a client with main up-to-date):

git checkout main
git pull origin main
git checkout -b develop
git push -u origin develop

Other devs then:

git fetch origin
git checkout develop
git pull

Which to pick

  • If you want the branch available instantly without needing a client: use Gitea web UI.
  • If someone is already working locally and wants to start straight away: create locally and push.

Both methods are equivalent once pushed; choose what’s quickest for your team.

Recommended final step

Protect main (require PR for merges) and set develop as the default working branch if you prefer developers to clone/pull develop by default.