Get started with Git

Photo by Emma Frances Logan on Unsplash
$ git status
On branch master
No commits yetnothing to commit
source: https://itnext.io/git-concepts-for-newcomers-part-2-git-repository-working-tree-and-staging-area-a2e720bf3528
  • Regular branches (or main branches): these branches are available permanently in the repository, the naming convention of regular branches is easy and straightforward, we can mention master and develop.
  • Temporary branches (or support branches): these branches are created by team members and they serve a purpose and once purpose fulfilled they can be deleted, we can mention featureand hotfix.
Source: https://nvie.com/posts/a-successful-git-branching-model/

Main branches

Source:https://nvie.com/posts/a-successful-git-branching-model/
  • master: the master branch is the origin, and we consider origin/master to be the main branch where the source code of HEAD always reflects a production-ready state.
  • develop: We consider origin/develop to be the main branch where the source code of HEAD always reflects a state with the latest delivered development changes for the next release. Some would call this the integration branch.

Supporting branches

Source:https://nvie.com/posts/a-successful-git-branching-model/
May branch off from: develop
Must merge back into: develop
Branch naming convention: anything except master, develop, release-*, or hotfix-*
May branch off from: develop
Must merge back into: develop and master
Branch naming convention: release-*
Source: https://nvie.com/posts/a-successful-git-branching-model/
May branch off from: master
Must merge back into: develop and master
Branch naming convention: hotfix-*

Adapting Gitflow to the deployment environment

  • Development: this is the environment in which the developers get to test and see their code running altogether, that’s why use the develop branch.
  • Pre-production: this environment presents the before-production state in which we have a stable tested version of the application, so for this environment, we use one of the release branches.
  • Production: this is also the client environment, is the recent stable version of the application and we only upload make changes in the final phase of the development of a feature or features. We use the master branch for this environment.

Naming conversions of supporting branches

  • We separate the branch’s name from the rest of the naming with a slash (hotfix/, feature/, release/).
  • In the case of features branches, we add the scope of the feature right after the slash for example feature/authentification.
  • In the case of issue tracker software (like mantis), we can add the ID of the issue to the name of the branches of feature or hotfix, for example, hotfix/mantis.7589.
  • We can also use the date as a reference to the release branches as release/YYYY.MM.DD if we have multiple consecutive versions.

The perfect commit

<type>[optional scope]: <description>
  • build: when changes affect the system of build or external dependencies (npm, make, pip … ).
  • ci: when changes concern files and scripts of the continuous integration (Travis, Ansible …).
  • feat: when new functionality is being added.
  • fix: when a bug is being fixed.
  • perf: when performances are being improved.
  • style: changes that improve the code by add no functional or semantic improvement (indentation, spaces, names of variables, comments …).
  • docs: the changes in the documentation of the code (wiki, README …).
  • test: the add or change of tests of the code.

Bonus: Git commands cheat sheet

References:

--

--

--

Software Engineer | Technical Writer | IT Enthusiast

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

Generics in Swift

Systemd and units

How to install an SSL Certificate on GlassFish?

Investigating Machine Learning Techniques to Improve Spec Tests — II

Failover Group and SSL Certification

Load Shedding for Busy Services

Ryzen 5 3600 vs Intel i5 9400F by Hi! TechTalk

Cloud Next 2018— a whirlwind week at Google’s annual cloud conference

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Aicha Fatrah

Aicha Fatrah

Software Engineer | Technical Writer | IT Enthusiast

More from Medium

HowTo: Building a Windows 2019 Docker Image with SQL Server 2019

Webhook Mock Service in Python

Sketch for testing messages sent from SUT — Sketch created with excalidraw.com

Starting With Git and GitHub

Getting git to work in a Windows docker container