Git as a Version Control tool has become ubiquitous and it's use and importance in the DevOps space cannot be overemphasized considering that it is used for versioning
Configuration files and scripts (IaC),
Storing and collaborating on Automation scripts, and also for
Triggering build automation (CI/CD pipelines).
Git's wide usage in the DevOps space has led to the concept of GitOps where it serves as the single source of truth for both application code and environment configurations.
After spending a few days studying Git and it's usage I decided to write a few things (best practices and tips) that I want to remember.
ย
Tips and Best Practices
Use the
git configcommand to adequately configure your commit authorship.It is important to use meaningful and descriptive commit messages.
Commit small chunks and only related work as it makes it easier to review/audit your work.
Pull often from your remote git repo using
git pull --rebaseto keep your branch up to date and possibly avoid merge conflicts.Use
git resetmainly to reverse local changes.Use
git revertto reverse changes that have been merged to your remote git repo.Create and use a new branch for a new feature or bugfix and name the branch with the prefix feature/* and bugfix/* respectively.
Thank you for reading and please feel free to ask questions or share other useful tips in the comment section.
Top comments (0)