# Git Conventions

# Installation and Configuration

Git Installation Git Configuration

# Branches

Branches are used to isolate development work without affecting other branches in the repository. Each repository has one default branch, e.g., master. While not all repository systems init the repo with a branch named master (could be main, etc.) we stick with the naming master to have a standard over all our applications. Beside the master branch normally there is an integration branch (optional: e.g. develop) and we can have multiple other branches. You can merge a branch into another branch using a pull request.

# Branch types

Common branch types are:

  • master
    • should contain the latest stable version
  • develop
    • used for integration of working branches
  • feature/
    • working branch for implementing features
    • e.g. feature/3456-back-btn-for-landing-page
  • bugfix/
    • working branch for fixing bugs
    • e.g. bugfix/332-wrong-response-structure
  • refactoring/
    • working branch for cleanups, optimizations or updating of dependencies (e.g. libs, pulgins, etc.)
    • e.g. refactoring/346-increase-php-version

# Working with branches

Standard flow

  1. init you project with
> git init
  1. add a .gitignore file like in this example:
# Editors (mandatory - always add this part)
.idea
.vscode
*.suo
*.ntvs*
*.njsproj
*.sln
*.sw*
*.iml
*.class
.project
.settings

# OS generated files (mandatory - always add this part)
.DS_Store
.DS_Store?
._*
.Spotlight-V100
.Trashes
ehthumbs.db
Thumbs.db

# List of common ignore categories - depends on environment:

# Package directories (e.g., node_modules, jspm_packages, ...)

# Serverless directories (e.g., .serverless)

# Webpack directories e.g. .webpack

# Logs (e.g., logs, *.log, npm-debug.log*, lock.json)

# Coverage directory (e.g., coverage/)

# Reports dicrectory (e.g., reports/)

# Compiled binary addons (e.g., build/)

# Dependency directories (e.g., node_modules/ )

# Optional npm cache directory (e.g., .npm)

# Optional eslint cache (e.g., .eslintcache)

# Output of 'npm pack' (e.g., *.tgz)

# dotenv environment variables file (e.g., .env)
  1. create a development branch from master
> git branch -b develop
  1. create a feature branch from develop
> git branch -b feature/<TicketNumber>-my-description
  1. implement your changes
  2. commit your changes using conventional commits
> git commit -m '...' -b
  1. push your changes
> git push
// If your branch in not known remotly yet git will promt the command to push it to origin
  1. Create a pull request
Page Info: Created by GitHub on Jun 9, 2023 (last updated a minute ago by GitHub)