Skip to content
Related Articles

Related Articles

How to Make Changes to The Application Deployed on Heroku ?

View Discussion
Improve Article
Save Article
Like Article
  • Difficulty Level : Basic
  • Last Updated : 11 May, 2022

Many of the times we need to make changes to our deployed project for some reason. Either we want to have a new version of the project, add new features to the project, remove a bug, or for some other reasons. If your project is deployed on Heroku Cloud Platform, you can easily make your changes using the CLI and deploy them to Heroku. In this blog, we will discuss the step-by-step process to make changes in your project and deploy it on Heroku.  Let’s start first with the short introduction of Heroku…

Heroku is a cloud platform service that allows you to build, deliver, monitor, and scale apps. It is a container-based cloud Platform as a Service (PaaS). It provides the freedom to the developers to focus on the core product instead of getting distracted from maintaining servers, hardware, or infrastructure. 

Prerequisite: Introduction and Installation of Heroku CLI

Step 1: Download and install Heroku CLI

Heroku CLI can easily be downloaded and installed by the following the steps given here. Make sure to log in to Heroku CLI.

After successful login, you will see the following in the terminal :

Step 2:  Clone your repository

Open another terminal and use git to clone your repository.

$ heroku git:clone -a your_app
$ cd your_app

Step 3: Make your changes

Make all the required changes in your project 

Step 4: Deploy your changes

$ git add .
$ git commit -am "changes made to the project"
$ git push heroku master

Enjoy! Your project is now successfully updated and deployed.

Now, in case if you want to change your main deploy branch from “master” to “main”(any other branch) for both manual and automatic deploys, you can do so by following these simple steps:

Step 1: Switch default branch from master to main

To do this we first need to create a new branch locally.

$ git checkout -b main

Step 2: Delete the old branch locally

We need to delete the old branch so that the local environment only knows about the main branch.

$ git branch -D master

Step 3: Reset the GIT repository hosted on the Heroku

This will empty the remote repository but it will not impact the running application.

$ heroku repo:reset -a your_app

Step 4: Redeploy the application

Finally, using the new default branch you can redeploy the application.

$ git push heroku main

My Personal Notes arrow_drop_up
Recommended Articles
Page :

Start Your Coding Journey Now!