DEV Community

Cover image for Git workflow best Practices and project containerization
Richard Munyemana
Richard Munyemana

Posted on

Git workflow best Practices and project containerization

Git workflow encourages developers and DevOps teams to to leverage Git effectively and consistently, it offers flexibility and good way of tracking and managing changes from time to time.

containerization combines application and its dependencies into one infrastructure.

Why do we need to write conventional commits?

communicating the nature of changes on your project to your teammates, public and stakeholders, makes it easier for people who want to contribute to your project by allowing them to explore a more structured commit history so that it is easy for them to understand what changes you made and where you have done that.

here is how conventional commit is structured:

<type>(scope):<brief description>

// `<type>`:here you put the type of the fix you did
// whether it is a **feature**, **chore** or a **bug** you fixed.
//`scope`:this introduces breaking API changes
 - [add detailed body]

finishes #storyId
//references to closing an issue that you were working onto.
Enter fullscreen mode Exit fullscreen mode

But How would I describe what my pull request or Merge request for those who use gitlab so that it is easy for the reviewer to know what he/she is going to be looking for?

below is the list of questions that you need to be answering when describing you PR or merge Request

in your PR description before creating a Pull request.

# What does this PR do?

# Description of Task to be completed?

# How should this be manually tested?

# Any background context you want to provide?

# What are the relevant pivotal tracker stories?

# Screenshots (if appropriate)

# Questions:
Enter fullscreen mode Exit fullscreen mode

How would you run different versions of your application on the same server? what would you do or how would you do it?

to answer these questions this is where docker comes into play,
Docker enables you to run different versions of your app on the same server without interference.
then how do I setup docker for windows:

  1. Download docker for desktop here
  2. follow instruction and install docker.
  3. create a docker file in your project directory
FROM node:version

    // Create app directory
    WORKDIR /app

    // Install app dependencies
    COPY . .
   //depending on package manager you are using in your project
    RUN npm install or yarn install

    // Binding to PORT 3000
    EXPOSE 3000

    //starting your project start script
    CMD ["npm or yarn", "start"]
Enter fullscreen mode Exit fullscreen mode
  1. run build to create docker image
//to make sure that your docker daemon is up and running in your terminal run 

docker ps
//start building your image by running

docker build -t tag-name

//then run 
docker run -p PORT:PORT -it tag-name
//make sure that the port you use is the one you have in your docker-file.
Enter fullscreen mode Exit fullscreen mode

Git workflow and dockerization makes thing easy when working with a team and even on your own projects you may need to refer to a past commit you made months ago and it will be much easier to know what were the changes you made the same for Pull request description.
And while sharing the OS containers provide workload isolation.

Top comments (0)