fbpx
Learn to build large language model applications: vector databases, langchain, fine tuning and prompt engineering. Learn more

Git practices

Zaid - Author images
Zaid Ahmed
| May 17

MAANG has become an unignorable buzzword in the tech world. The acronym is derived from “FANG”, representing major tech giants. Initially introduced in 2013, it included Facebook, Amazon, Netflix, and Google. Apple joined in 2017. After Facebook rebranded to Meta in June 2022, the term changed to “MAANG,” encompassing Meta, Amazon, Apple, Netflix, and Google.

MAANG

Moreover, efficient collaboration and version control are vital for streamlined software development. Enter Git, the ubiquitously distributed version control system that has become the gold standard for managing code repositories. Discover how Git’s best practices enhance productivity, collaboration, and code quality in big organizations.

Top 10 Git practices followed in MAANG

1. Creating a clear and informative repository structure 

To ensure seamless navigation and organization of code repositories, we should follow a well-defined structure for their GitHub repositories. Clear naming conventions, logical folder hierarchies, and README files with essential information are implemented consistently across all projects. This structured approach simplifies code sharing, enhances discoverability, and fosters collaboration among team members. Here’s an example of a well-structured repository:  

Creating a repository structure
Creating a repository structure

By following such a structure, developers can easily locate files and understand the overall project organization.  

2. Utilizing branching strategies for effective collaboration  

The effective utilization of branching strategies has proven instrumental in facilitating collaboration between developers. By following branching models like GitFlow or GitHub Flow, team members can work on separate features or bug fixes without disrupting the main codebase. This enables parallel development, seamless integration, and effortless code reviews, resulting in improved productivity and reduced conflicts. Here’s an example of how branching is implemented: 

Utilizing branching strategies
Utilizing branching strategies

3. Implementing regular code reviews  

MAANG developers place significant emphasis on code quality through regular code reviews. GitHub’s pull request feature is extensively utilized to ensure that each code change undergoes thorough scrutiny. By involving multiple developers in the review process. Code reviews enhance the codebase’s quality and provide valuable learning opportunities for team members. 

Here’s an example of a code review process: 

  1. Developer A creates a pull request (PR) for their code changes. 
  2. Developer B and Developer C review the code, provide feedback, and suggest improvements. 
  3. Developer A addresses the feedback, makes necessary changes, and pushes new commits. 
  4. Once the code meets the quality standards, the PR is approved and merged into the main codebase. 


By following a systematic code review process, MAANG ensures that the codebase maintains a high level of quality and readability.
 

4. Automated testing and continuous integration 

Automation plays a vital role in MAANG’S GitHub practices, particularly when it comes to testing and continuous integration (CI). MAANG leverages GitHub Actions or other CI tools to automatically build, test, and deploy code changes. This practice ensures that every commit is subjected to a battery of tests, reducing the likelihood of introducing bugs or regressions into the codebase. 

Automated testing and continuous integration
Automated testing and continuous integration

5. Don’t just git commit directly to master 

 Avoid committing directly to the master branch in Git, regardless of whether you follow Gitflow or any other branching model. It is highly recommended to enable branch protection to prevent direct commits and ensure that the code in your main branch is always deployable. Instead of committing directly, it is best practice to manage all commits through pull requests.  

Manage all commits through pull requests
Manage all commits through pull requests

6. Stashing uncommitted changes 

If you’re ever working on a feature and need to do an emergency fix on the project, you could run into a problem. You don’t want to commit to an unfinished feature, and you also don’t want to lose current changes. The solution is to temporarily remove these changes with the Git stash command: 

Stashing uncommitted changes
Stashing uncommitted changes

7. Keep your commits organized 

You just wanted to fix that one feature, but in the meantime got into the flow, took care of a tricky bug, and spotted a very annoying typo. One thing led to another, and suddenly you realized that you’ve been coding for hours without actually committing anything. Now your changes are too vast to squeeze in one commit… 

Keep your commits organized
Keep your commits organized

8. Take me back to good times (when everything works flawlessly!)  

It appears that you’ve encountered a situation where unintended changes were made, resulting in everything being broken. Is there a method to undo these commits and revert to a previous state?  With this handy command, you can get a record of all the commits done in Git. 

Git Command
Git Command

All you must do now is locate the commit before the troublesome one. The notation HEAD@{index} represents the desired commit, so simply replace “index” with the appropriate number and execute the command. 

And there you have it you can revert to a point in your repository where everything was functioning perfectly. Keep in mind to only use this feature locally, as making changes to a shared repository is considered a significant violation.  

9. Let’s confront and address those merge conflicts commits

You are currently facing a complex merge conflict, and despite comparing two conflicting versions, you’re uncertain about determining the correct one. 

Resolving merge conflicts
Resolving merge conflicts

Resolving merge conflicts may not be an enjoyable task, but this command can simplify the process and make your life a bit easier. Often, additional context is needed to determine which branch is the correct one. By default, Git displays marker versions that contain conflicting versions of the two files. However, by choosing the option mentioned, you can also view the base version, which can potentially help you avoid some difficulties. Additionally, you have the option to set it as the default behavior using the provided command.

10. Cherry-Picking commits

Cherry-picking is a Git command, known as git cherry-pick, that enables you to selectively apply individual commits from one branch to another. This approach is useful when you only need certain changes from a specific commit without merging the entire branch. By using cherry-picking, you gain greater flexibility and control over your commit history. 

Cherry-Picking commits
Cherry-Picking commits

In a nutshell

The top 10 Git practices mentioned above are indisputably essential for optimizing development processes, fostering efficient collaboration, and guaranteeing code quality. By adhering to these practices, MAANG’s Git framework provides a clear roadmap to excellence in the realm of technology. 

Prioritizing continuous integration and deployment enables teams to seamlessly integrate changes and promptly deploy new features, resulting in accelerated development cycles and enhanced productivity. Embracing Git’s branching model empowers developers to work on independent features or bug fixes without affecting the main codebase, enabling parallel development and minimizing conflicts. Overall, these Git practices serve as a solid foundation for efficient and effective software development 

 

Related Topics

Statistics
Resources
Programming
Machine Learning
LLM
Generative AI
Data Visualization
Data Security
Data Science
Data Engineering
Data Analytics
Computer Vision
Career
Artificial Intelligence