- Git
version 2.34.0or higher - Git Bash (Windows users)
Important: β Use SSH when working locally. β Do not use personal access tokens when working with repositories locally. Instead, use SSH keys.
When working with repositories on your local machine, use SSH to perform Git actions such as clone, push, and pull.
π‘ The ~ symbol used in most of the commands below represents the home directory regardless of the OS, for example:
- On Linux:
~/refers to/home/username/ - On Windows:
~/refers toc:/users/username/
~/.ssh- If it does not exist, create it before proceeding with the next steps:
mkdir -p ~/.sshssh-keygen -t ed25519 -C "[email protected]"cat ~/.ssh/id_ed25519.pubGitHub Account β Settings β SSH and GPG keys
- Once created, click on "Configure SSO" and click on "Authorize" for
github-group-name.
git config --global gpg.format ssh
git config --global user.name "<git-username>"
git config --global user.email "[email protected]"
git config --global user.signingkey ~/.ssh/id_ed25519.pubπ‘ To have all commits signed by default, add the following to the git config settings:
git config --global commit.gpgsign truemkdir -p ~/.config/git
touch ~/.config/git/allowed_signersecho "$(git config user.email) $(cat ~/.ssh/id_ed25519.pub)" >> ~/.config/git/allowed_signerscat ~/.config/git/allowed_signersExpected Output:
[email protected] ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAICz....
git config --global gpg.ssh.allowedSignersFile ~/.config/git/allowed_signersgit log --show-signature -1ssh -T [email protected]Important: Before creating a new branch, always sync the local repo with the remote one.
git checkout main
git pull- Create the branch with a name corresponding to the Jira ticket number:
git checkout -b jira_ref_numberExample:
git checkout -b erm_123-
feat:β Adding a new feature. -
fix:β Fixing a bug. -
refactor:β Improving code without changing functionality (e.g., readability, optimization). -
chore:β Miscellaneous changes (docs, formatting, CI/CD, tests, cleanup, etc.). -
Each commit should be signed using the
-Sflag:
git commit -S- For short commit messages:
git commit -S -m "<category>(<jira reference number>): <short summary>"Example:
git commit -S -m "feat(ERM-123): Add a new dimensions table"- For detailed commit messages (when omitting the -m flag git will automatically open the default Text editor where to specify both the commit subject line and message body):
git commit -SExample commit message format:
feat(ERM-123): Add a new dimensions table
A new dimension table has been added for the stores data.
This table will keep only the necessary data columns loaded from the cleansed source store list table.
β
Pre-commit checks run automatically.
git push origin jira_ref_numberExample:
git push origin erm_123Commit Guidelines:
- Keep subject lines up to 50 characters (hard limit: 72).
- Use capitalized subject lines.
- Do not end subject lines with a period.
- Pull Request Title Format:
Pull Request - <category>(<jira reference number>): <short summary>
Example:
Pull Request - feat(ERM-123): Add a new dimensions table
β οΈ Important: Pull requests can be merged only when they are approved by the corresponding reviewer(s).
- Merge Subject Line Format:
Merge pull request #PR_NUMBER from <jira ticket title>
Example:
Merge pull request #3 from new_dim_table
Important: Before merging, sync the local repo with the remote one.
git checkout main
git pull- Each merge should be signed:
git merge -S- Fast-forward merge:
git merge jira_ref_number -S -m "Merge pull request #PRNUM from <jira reference number>" -m "<category>(<jira reference number>): <short summary>"Example:
git merge erm_123 -S -m "Merge pull request #3 from <jira reference number>" -m "feat(ERM-123): Add a new dimensions table"πΉ Following these best practices ensures better security, clarity, and efficiency when working with GitHub repositories! πΉ