Commit Patterns
Learn to write semantic and professional commits
Commit Patterns
Types of Commits
Semantic commits have the following structural elements (types), which inform the intent of your commit to the user of your code.
feat
Indicates that your code snippet is including a new functionality (related to MINOR in semantic versioning).
git commit -m ":sparkles: feat: adicionar autenticação de usuário"fix
Indicates that your committed code snippet is solving a problem (bug fix), it is related to PATCH in semantic versioning.
git commit -m ":bug: fix: corrigir loop infinito na validação"docs
Indicates that there have been changes to documentation, such as in your repository's README (does not include code changes).
git commit -m ":books: docs: atualizar README com instruções"style
Indicates that there were changes related to code formatting, semicolons, whitespace, lint (does not include code changes).
git commit -m ":lipstick: style: corrigir formatação do código"refactor
Refers to changes due to refactoring that do not alter functionality, such as performance improvements due to code review.
git commit -m ":recycle: refactor: otimizar algoritmo de busca"perf
It serves to identify any performance-related code changes.
git commit -m ":zap: perf: melhorar tempo de carregamento"test
Used when changes are made to tests, whether creating, modifying or deleting unit tests (does not include code changes).
git commit -m ":test_tube: test: adicionar testes unitários"build
Used when modifications are made to build files and dependencies.
git commit -m ":package: build: atualizar dependências"ci
Indicates changes related to continuous integration.
git commit -m ":bricks: ci: configurar pipeline de deploy"chore
Indicates updates to build tasks, admin settings, packages (does not include code changes).
git commit -m ":wrench: chore: atualizar .gitignore"raw
Indicates changes related to configuration files or raw data.
git commit -m ":card_file_box: raw: dados brutos do projeto"cleanup
Indicates code cleanup, removal of unnecessary comments, and general optimizations.
git commit -m ":broom: cleanup: remover código não utilizado"remove
Indicates removal of files, features or code that are no longer needed.
git commit -m ":wastebasket: remove: deletar arquivos obsoletos"Emoji Patterns
| Commit type | Emoji | Keyword |
|---|---|---|
| Accessibility | ♿ | :wheelchair: |
| Adding a test | ✅ | :white_check_mark: |
| Updating submodule version | ⬆️ | :arrow_up: |
| Downgrading submodule version | ⬇️ | :arrow_down: |
| Adding a dependency | ➕ | :heavy_plus_sign: |
| Code review changes | 👌 | :ok_hand: |
| Animations and transitions | 💫 | :dizzy: |
| Bug fix | 🐛 | :bug: |
| Comments | 💡 | :bulb: |
| Initial commit | 🎉 | :tada: |
| Settings | 🔧 | :wrench: |
| Deploy | 🚀 | :rocket: |
| Documentation | 📚 | :books: |
| In progress | 🚧 | :construction: |
| UI Styling | 💄 | :lipstick: |
| Infrastructure | 🧱 | :bricks: |
| Task list | 🔜 | :soon: |
| Move/Rename | 🚚 | :truck: |
| New functionality | ✨ | :sparkles: |
| Package.json in JS | 📦 | :package: |
| Performance | ⚡ | :zap: |
| Refactoring | ♻️ | :recycle: |
| Code cleaning | 🧹 | :broom: |
| Removing a file | 🗑️ | :wastebasket: |
| Removing a dependency | ➖ | :heavy_minus_sign: |
| Responsiveness | 📱 | :iphone: |
| Reverting changes | 💥 | :boom: |
| Security | 🔒 | :lock: |
| SEO | 🔍 | :mag: |
| Version Tag | 🔖 | :bookmark: |
| Pass test | ✔️ | :heavy_check_mark: |
| Tests | 🧪 | :test_tube: |
| Text | 📝 | :pencil: |
| Typing | 🏷️ | :label: |
| Error handling | 🥅 | :goal_net: |
| Data | 🗃️ | :card_file_box: |
Main Git Commands
Clone Repository
Clones an existing remote GitHub repository to your local environment.
git clone url-do-repositorio-no-githubInitialize Repository
Initializes a new Git repository in the current directory.
git initAdd Files
Adds all files and changes in the current directory to the staging area.
git add .Make Commit
Records changes added to the staging area with a descriptive message.
git commit -m "mensagem do commit"Rename Branch
Renames the current branch (master) to main. -M is used to force renaming.
git branch -M mainAdd Remote Repository
Adds a remote repository called origin to the local repository.
git remote add origin https://github.com/usuario/nome-do-repositorio.gitSend to Repository
Sends commits from the local branch to the remote repository.
git push -u origin mainUpdate from Repository
Updates the local branch with changes from the remote repository.
git pull origin mainConnect Local Repository
When you already have a local repository and want to connect it to a remote repository on GitHub.
git remote add origin git@github.com:usuario/projeto.gitgit branch -M maingit push -u origin mainFetch Updates
Fetches all updates from the remote repository without merging them into the current branch.
git fetchSafe Forced Push
Safer way to force local changes to be pushed to the remote repository.
git push --force-with-leaseRevert Commit
Creates a new commit that undoes the changes made by the specified commit.
git revert id_do_commit_que_vai_ser_revertidoReset Commit
Resets the repository to the specified commit state, deleting all subsequent changes.
git reset --hard id_do_commit_anterior_ao_que_vai_ser_apagadoChange Commit Message
Changes the message of the last commit.
git commit --amend -m "mensagem_reescrita"Cherry Pick
Used to grab a specific commit from another branch.
git cherry-pick HASH_DO_COMMITSwap Branch
Switch to a different branch in the local repository.
git switch <branch>Glossary
fork
Copy a repository to your own GitHub account.
issues
Tool used to manage tasks and bug fixes.
pull request
Mechanism used to submit proposed changes to the original repository.
gist
Tool for sharing code snippets.
💡Important Tips
- ✓Use clear, descriptive messages that explain what has been changed
- ✓Keep commits small and focused on a single feature
- ✓Use the correct commit type to make history navigation easier
- ✓Always test your changes before committing