DEV Community

Lukas Gaucas
Lukas Gaucas

Posted on • Updated on

Heroku CRUD #101

BE NOTICED : This article is Windows Git users oriented !


Prereqs :

NOTE : We will ignore file tracking for Git in this article !


Create & Status

As you probably guess, today was my first day into Heroku , so I will recap what I've learned , which was nearly the terminal CRUD basics on Git for Heroku (check for ready-to-go refs at very end of this article as well – that may save some time of your day surfing for instructions to follow)

For the start Heroku asks us to initiate our Heroku app repo with specific signature of :

heroku create # creates a new empty application on Heroku, along with an associated empty Git repository.
Enter fullscreen mode Exit fullscreen mode

For the sake of simplicity I will copy-paste some of info from Heroku officials ; Whenever we init with command of heroku create we should get sth like :

Creating app... done, ⬢ thawing-inlet-61413
https://thawing-inlet-61413.herokuapp.com/ | https://git.heroku.com/thawing-inlet-61413.git
Enter fullscreen mode Exit fullscreen mode

Explanation: one url is for app deployment | one for heroku-based repo
The later one also would match if git remote -v invoked , i.e.:

heroku https://git.heroku.com/thawing-inlet-61413.git (fetch)
heroku https://git.heroku.com/thawing-inlet-61413.git (push)
Enter fullscreen mode Exit fullscreen mode

Let's say we made it , we double-checked if it really existed on https://dashboard.heroku.com/apps we should see some dummy name of heroku-based such as corresponding thawing-inlet-61413 as a part of URI (URL)


Now imagine you decided to append your list with another-crud-app which let it be our next heroku create another-crud-app – this way we could add some meaningful name within next init of heroku repository . We double checked our dashboard as last time , we probably saw something like so :

Creating app... done, ⬢ another-crud-app
https://another-crud-app.herokuapp.com/ | https://git.heroku.com/another-crud-app.git
Enter fullscreen mode Exit fullscreen mode

We probably ask ourselves : "Okay currently we made with two apps , even tho it could be more of 'em . How should I list 'em all ?" – Very simple , just do the following command on terminal :

heroku apps # this should print our list of two apps already created (see below)
Enter fullscreen mode Exit fullscreen mode

App list created :

  • thawing-inlet-61413
  • another-crud-app

Nevertheless we already created two apps , command of heroku info still confirms we are are set on the former (old) repo of :

=== thawing-inlet-61413
Auto Cert Mgmt: false
Dynos:
Git URL:        https://git.heroku.com/thawing-inlet-61413.git
...
Web URL:        https://thawing-inlet-61413.herokuapp.com/
Enter fullscreen mode Exit fullscreen mode

This was actually a tricky part I wanted you to pay most of attention at of . We all know Heroku is strongly related to Git version control system , where as Git strongly related to GitHub . Heroku integrates with GitHub to make it easy to deploy code living on GitHub to apps running on Heroku , those are two different platforms (if I could express that way – "platforms") tho . What I am trying to say here , is that both shares similar approach (in layman's terms – vibe) . This means that if you created one Heroku repo for your app and after created the next one and the next one : every time you create next repo for your app you need to switch between repos manually – in order to do so use the following signature :

heroku git:remote -a another-crud-app # equivalent to --add=another-crud-app
Enter fullscreen mode Exit fullscreen mode

Now we should completely be set on recently created app for both : Heroku deployment and Heroku git-based repo . Double checked with the command of heroku info we should see the following :

=== another-crud-app
Auto Cert Mgmt: false
...
Enter fullscreen mode Exit fullscreen mode

Delete & Status

We can delete desired Heroku app exploiting following command :

heroku destroy -a another-crud-app -c another-crud-app # equivalent to --confirm=another-crud-app
Enter fullscreen mode Exit fullscreen mode

Complete destroy command reference

NOTE : deleting repo with destroy command also requires mandatory manual reset of remote

If heroku info invoked this would yield pretty much like that :

No app specified.
 !    USAGE: heroku info my-app 
Enter fullscreen mode Exit fullscreen mode

Of course we could do the following as heroku info thawing-inlet-61413 which would support us with info , but you should not buy into 'cause git remote -v would yield you nothing . As mentioned per NOTE above – we must explicitly reset to the app of choice required as for an example :

heroku git:remote -a thawing-inlet-61413 # equivalent to --add=thawing-inlet-61413
Enter fullscreen mode Exit fullscreen mode

This time it's enough of heroku info without providing name and git remote -v should support you with the following info as expected :

heroku  https://git.heroku.com/thawing-inlet-61413.git (fetch)
heroku  https://git.heroku.com/thawing-inlet-61413.git (push)
Enter fullscreen mode Exit fullscreen mode

We got back as we'd been before creating recent app of another-crud-app


Ready-to-go refs :


If any typos found and (or) suggestions could be made, please leave it in the comment section below . Thank you and see you in the next one !

Top comments (0)