0

I am needing to commit a file to a rolled back commit on Heroku. I am currently running a rollback after a bug caused issues on Master which we are fixing. However I need to update the app.js on the rolled back version. Is this possible?

asked Oct 17, 2021 at 13:54
2
  • What do you mean by "update the app.js on the rolled back version"? Do you want to run a previous release, but with some changes? Commented Oct 17, 2021 at 16:06
  • Thats exactly it @Chris Commented Oct 17, 2021 at 16:09

1 Answer 1

1

If you want to run a previous release but you need to make changes to it, you're not doing a rollback. A rollback runs the compiled application slug from the previous release; there is no way to change the code in that release.

You need to run from another branch. If your commit graph looks something like this:

o---o---o [old-release]
 \
 o---o [main]

and you want to go back to old-release but change something, you'll need to create a new branch off of old-release, make your changes there, commit them, and then deploy from that new branch.

One way to do this would be to

  1. Create the new branch with git checkout -b bug-fix old-release
  2. Make your changes
  3. Commit
  4. Deploy the bug-fix branch to Heroku by running git push bug-fix:main (or git push bug-fix:master if you are using master as your main branch)

This will build a whole new release.

Your commit graph will now look something like this:

 A [bug-fix]
 /
o---o---o [old-release]
 \
 o---o [main]

You might choose to rebase your main development line onto the bug-fix branch:

 o---o [main]
 /
 A [bug-fix]
 /
o---o---o [old-release]

Or cherry-pick the new commit into main:

 A [bug-fix]
 /
o---o---o [old-release]
 \
 o---o---A' [main]

If you don't have an old-release branch you can use the Git hash instead of a branch name when creating the bug-fix branch, e.g. with git checkout -b bug-fix abcd1234.

answered Oct 17, 2021 at 16:19
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.