Table of Contents
In this project were introducing the basic and to advanced guide to use github and git commands effectively
Semantic Commits are standardized commit messages that describe what type of change you're making.
Format: <type>(<scope>): <subject> <des>
<scope> is optional, but recommended for more detailing
feat(feature.html): add feature respect
^--^ ^----------^ ^-----------------^
| | |
| | +-> Description
| |
| +--> Scope
|
+---> Type: (e.g., build, chore, ci, docs, feat, fix, perf, refactor, style, test)
More Examples:
feat: New feature. e.g,feat: add user registrationfix: Bug fix. e.g,fix: resolve login timeoutdocs: Documentation. e.g,docs: update API documentationstyle: Cosmetic changes to the code that do not affect its behavior or functionality formatting. e.g,style: fix code indentationrefactor: Rewriting existing code to improve effectivly. e.g,refactor: simplify auth middlewaretest: e.g,test: add unit tests for utilschore: General Maintenance tasks. e.g,chore: update dependenciesperf: Performance improvement. e.g,perf: optimize database queriesciCI/CD. e.g,ci: add github actions workflowbuildBuild system. e.g,build: update webpack configuration
References:
- https://www.conventionalcommits.org/
- https://seesparkbox.com/foundry/semantic_commit_messages
- http://karma-runner.github.io/1.0/dev/git-commit-msg.html
Semantic Versioning is a simple rule system for version numbers: MAJOR.MINOR.PATCH
v1.2.3
│ │ └── PATCH: Bug fixes, minor changes
│ └───── MINOR: New features (backward compatible)
└───────── MAJOR: Breaking changes
# Release stable version
v1.0.0 # Initial release
v1.0.1 # Hotfix bug critical
v1.1.0 # Adding New Feature
v2.0.0 # Breaking changes (require migration)
# Pre-release versions, Development
v1.1.0-alpha.1 # Testing internal
v1.1.0-beta.1 # Testing with limited user
v1.1.0-rc.1 # Release candidate
main/production → v1.2.3 (stable releases)
develop → v1.3.0-alpha.1 (development)
feature/auth-jwt → from development
hotfix/critical-bug → from main
- Git Installed
- Having an Github Account
- Code Editor
-
Create $PROFILE Files For Powershell
New-Item -Path $PROFILE -Type File -Force
-
On $PROFILE Files Copy This
#GitAcc function gacc1 { git config --global user.name "your-github-username" git config --global user.email "your-github-email" Write-Host "✓ Using Account 1" -ForegroundColor Green } # Optional if you want 2 account in your workspace # function gacc2 { # git config --global user.name "your-github-username" # git config --global user.email "your-github-email" # Write-Host "✓ Using Account 1" -ForegroundColor Green # } # try to test it, shorthand for git config user.name/email function gashow { Write-Host "Git Config:" -ForegroundColor Cyan Write-Host "Name: $(git config user.name)" Write-Host "Email: $(git config user.email)" }
-
Make SSH Config File
mkdir -p ~/.ssh nano ~/.ssh/config
-
While on Nano Paste This
# ~/.ssh/config on Nano # Generate SSH keys for each account ssh-keygen -t ed25519 -C "account1@email.com" -f ~/.ssh/id_ed25519_acc1 #optional if want to make 2 account on github # ssh-keygen -t ed25519 -C "account2@email.com" -f ~/.ssh/id_ed25519_acc2 # Add to SSH config (~/.ssh/config) Host github-acc1 HostName github.com User git IdentityFile ~/.ssh/id_ed25519_acc1 Host github-acc2 HostName github.com User git IdentityFile ~/.ssh/id_ed25519_acc2
-
Open your .gitconfig file on your computer
On UNIX (MacOs or Linux)
~/.gitconfig // On UNIXOn Windows
%USERPROFILE%\.gitconfig // On Windows
-
Paste this to the config like so
[user] name = example email = 632486264+username@users.noreply.github.com [credential] helper = store [init] defaultBranch = main [alias] alias.st=status alias.ll=log --graph --oneline alias.last=log -1 HEAD --stat alias.cm=commit -m alias.rv=remote -v alias.co=checkout alias.br=branch -a alias.cam=commit --amend -m alias.cob=checkout -b alias.fap=fetch --all --prune alias.brd=branch -D
-
Check if its been paste correctly
git config --global -l
Clone a Repository
git clone gacc:owner-repo/repo-name.gitChecking Branch including remote branch
git brChecking Updated from Remote
git fapDeleting branch
git brd "name-branch"Push to Remote branch to Github
git push -u "name-branch"Overwrite push changes to Remote
git push origin dev --force-with-leaseReset branch to be the same as Targeted Branch
git reset --hard "name-branch"Coming Back to this Hash Safely
git reset --soft f374fahgsComing Back to this Hash Overwrite / Leaving ondoing Workspace
git reset --hard f374fahgsCreate a branch and switch to that branch
git cob "name-branch"Amend commit message nor code
git cam "the message of amend commit"Amend commit message nor code, with history
git revert "hash-commit"Delete Branch and Push to Remote to snyc
git push -u origin --delete "name-branch"Abort while merging
git merge --abortContributions are what make the open source community such an amazing place to learn, inspire, and create. Any contributions you make are greatly appreciated.
If you have a suggestion that would make this better, please fork the repo and create a pull request. You can also simply open an issue with the tag "enhancement". Don't forget to give the project a star! Thanks again!
- Fork the Project
- Create your Feature Branch (
git checkout -b dev/example) - Commit your Changes (
git commit -m 'Add some AmazingFeature') - Push to the Branch (
git push origin dev/example) - Open a Pull Request
Distributed under the project_license. See LICENSE.txt for more information.