It’s no surprise to learn that the team at GitKraken is passionate about Git. So passionate, in fact, that we created an educational database featuring our Learning Git with GitKraken YouTube series, educational white papers, cheat sheets, and more.
And our partners at Syncfusion are no different. In a previous article, Bharat Dwarkani, technical product manager at Syncfusion, describes how the Gitflow model has simplified his organization’s development and release processes. In this post, he shares guidelines for implementing and successfully utilizing Git.
Guidelines for Git Fundamentals
At Syncfusion, we’ve been using the Git workflow to manage complex products across a variety of products. However, to successfully collaborate with team members using Git, it’s important for everyone to be on the same page regarding how best to utilize version control for their specific use cases. Here is a list of dos and don’ts to help you navigate Git.
Git Dos
- Create a Git repository for every new project.
Learn more about what a Git repo is in this beginner Learning Git with GitKraken tutorial.
- Always create a new branch for every new feature and bug.
- Regularly commit and push changes to the remote branch to avoid loss of work.
- Include a gitignore file in your project to avoid unwanted files being committed.
- Always commit changes with a concise and useful commit message.
- Utilize git-submodule for large projects.
- Keep your branch up to date with development branches.
- Follow a workflow like Gitflow. There are many workflows available, so choose the one that best suits your needs.
- Always create a pull request for merging changes from one branch to another.
Learn more about what a pull request is and how to create them in this intermediate Learning Git with GitKraken tutorial.
- Always create one pull request addressing one issue.
- Always review your code once by yourself before creating a pull request.
- Have more than one person review a pull request. It’s not necessary, but is a best practice.
- Enforce standards by using pull request templates and adding continuous integrations.
Learn more about enhancing the pull request process with templates.
- Merge changes from the release branch to master after each release.
- Tag the master sources after every release.
- Delete branches if a feature or bug fix is merged to its intended branches and the branch is no longer required.
- Automate general workflow checks using Git hooks.
Learn more about how to trigger Git hooks in this intermediate Learning Git with GitKraken tutorial.
- Include read/write permission access control to repositories to prevent unauthorized access.
- Add protection for special branches like master and development to safeguard against accidental deletion.
Git Don’ts
- Don’t commit directly to the master or development branches.
- Don’t hold up work by not committing local branch changes to remote branches.
- Never commit application secrets in public repositories.
- Don’t commit large files in the repository. This will increase the size of the repository. Use Git LFS for large files.
Learn more about what Git LFS is and how to utilize it in this advanced Learning Git with GitKraken tutorial.
- Don’t create one pull request addressing multiple issues.
- Don’t work on multiple issues in the same branch. If a feature is dropped, it will be difficult to revert changes.
- Don’t reset a branch without committing/stashing your changes. If you do so, your changes will be lost.
- Don’t do a force push until you’re extremely comfortable performing this action.
- Don’t modify or delete public history.
Considering the previously listed dos and don’ts will help you use Git more effectively. But keep in mind, even Git experts like us are always learning and expanding our knowledge. And the good news is that Git clients like GitKraken are transforming the way developers interact with Git, making the process easier and your Git workflow more intuitive.