git tips
This page contains tips I came across.
revert¶
git reset
to unstage filesgit add
edgit checkout .
at the project root to revert all local uncommited changesgit reset --hard HEAD
also reverts back all local changesgit clean -fdxn
to dry-run clean up of all untracked files (git-tracked-files will remain), and omit-n
to execute
naming¶
Naming tips for branches and labels are:
- descriptive name, give immediate context for its purpose
feature/login
- use hyphens
bugfix/fix-login-issue
- use prefix or type where appropriate
feature/
for developing new featuresbugfix/
to fix something, and could be associated to an issuerelease/
to prepare a new release to do tasks for final revisions
- include ticket numbers
- use types in commit messages
- example template -
<type>(scope, optional): description
- example -
feat(parser): Add the ability to parse arrays
feat:
featuresfix:
bug fixesbuild:
chore:
refers to tasks that don’t directly affect the code but are necessary for maintenance or development- updating build process
- incorporating new modules
- configuration changes such as .gitignore updates
- internal code maintenance such as code clean up
- changes related to build tools, runners, and other utilities
ci:
style:
for code style changes such as formatting and indentationdocs:
pertains to documentation updatesrefactor:
denotes code refactoring without adding new features of fixing bugstest:
involves adding or modifying tests
- example template -