Skip to content

[EN] Git chart

Etoiles-ing edited this page Jun 1, 2023 · 3 revisions

Best Practices

Git Rules and Protection

Git Information

  • The 'main' branch is protected, you cannot push directly to it; you can only send changes to it from a release branch derived from 'develop' or a hotfix branch.
  • The 'develop' branch is protected, you cannot push directly to it; you need to create a pull request that must be approved by at least one person to merge your feature branch <features/featureName> into the develop branch.
  • The 'features' branches are under your responsibility, feel free to break them.

Forbidden Actions

  1. Do not push directly to the master branch.
  2. Do not commit code as an unrecognized author.
  3. Set code owners for faster code reviews.
  4. Do not disclose secrets in version control.

Basic Git Commands for Every Developer: (TO BE CLEANED UP)

Git pull:

git pull origin my-branch

Description: Git pull allows you to retrieve all the changes from the remote branch. It takes the source branch and the target branch as parameters.

Git fetch:

git fetch origin my-branch

Description: Git fetch allows you to search for and display changes on a specified remote that are not present locally, without transferring any files. The command git fetch wpk searches for new changes on the remote wpk that are not present locally.

Git checkout:

Description: Git checkout allows you to switch from one branch to another. It takes the target branch as an argument and also discards uncommitted changes.
Examples:

git checkout branch-A

Description: allows us to switch to the branch branch-A if it exists.

git checkout -b branch-B

Description: allows us to create and switch to the branch branch-B, and if it doesn't exist, it creates it.

git checkout path/file.php

Description: allows us to discard all uncommitted changes (unstaged) to the file path/file.php.

git checkout .

Description: allows us to discard all uncommitted changes (unstaged) to all files.

Git add:

Git add allows you to stage the changes you made to your files on the current branch. The two most important arguments for this command are:

git add *

Description: stages all the changes you made.

git add my_file

Description: stages modifications to the file already known by Git (new files will not be added).

Git commit:

Description: Git commit allows you to commit the changes you have made locally to the current branch.
Examples:

git commit -m "Commit message"

Description: commits the changes to the current branch with the message "Commit message".

git commit --amend

Description: commits the new changes to the current branch in the last commit you created on the branch.

Git reset:

Description: Git reset allows you to discard all the changes you made to the current branch. Examples:

git reset --hard HEAD

Description: returns to the version that is on the master branch.

git commit --amend

Description: commits the new changes to the current branch in the last commit you created on the branch.

Git push:

Description: Git push allows you to send the changes to a remote repository. Example:

git push origin branch-A

Description: sends the changes you made on the branch branch-A to your origin repository.

Git status:

git status

Description: displays all the uncommitted modifications on the current branch.

Branch Naming

  • main --> Production branch: This is where the robot pulls its stable and tested version.
  • develop --> Development branch: This is where features and bug fixes are integrated before being tested and merged into the branch.
  • feature/ --> Feature development branch: This is where features will be created.
  • hotfix/ --> Main bug fix branch: Perform necessary fixes starting from the main branch.
  • documentation --> Branch dedicated to adding and modifying documentation files (e.g., Read.Me).

Version Numbering

Version: X.Y.Z

  • X – Major: Non-backward-compatible changes, removal of obsolete functionality, modification of interfaces, renaming... (The things that break)
  • Y – Minor: Backward-compatible changes, introduction of new features, deprecation of existing functionality... (The things that add without breaking)
  • Z – Patch: Backward-compatible bug fixes, modification/correction of internal behavior, security vulnerabilities... (The things that fix defects or what is broken)

Node Naming

To reach an agreement and describe in the same way, our standard for declaring a node is as follows:

  • To be completed...

Clone this wiki locally