Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8845469
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T11:44:54+00:00 2026-06-14T11:44:54+00:00

I have got a web application within a git repository. Due to historic reasons

  • 0

I have got a web application within a git repository. Due to historic reasons the web application is not at the root of the repository, it is within a folder called website. Beside that there are some other folders, so that I have got the following structure:

myApp
+- .git
+- otherFolder1
+- otherFolder2
+- otherFolder...
+- otherFolderN
+- website

The website is run on Heroku. As Heroku demands that your web application is at the root of a git repository, until now I used a build process which copied the website folder to a completely different (external) folder with its own git repository. Then I was able to push from there to Heroku and everything was fine.

Now, since git includes the subtree command this is not necessary any longer, as I could directly push from my initial folder, but just the website sub-folder, using:

git subtree push --prefix=website heroku master

Basically, this works perfectly. I only have one problem: As the previous commits to Heroku came from a completely different git repository, the history of both doesn’t match each other – so Heroku detects a non-fast-forward push, and rejects the subtree push.

So how do I deal with this?

  • Idea 1: Force push. Tried that, but doesn’t work as git subtree push does not have a --force option (or anything similar).
  • Idea 2: Clear Heroku’s repository and start from scratch again.

I’d love to go with idea 2, but I have no idea of how to achieve this.

My first approach was to run a git push heroku :master, but Heroku detects this and denies it.

Of course, I could destroy the app and recreate it, but then all domain assignments and add-ons are gone as well, and I’d like to avoid that.

Any other ideas?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-14T11:44:56+00:00Added an answer on June 14, 2026 at 11:44 am

    You can nest git commands to execute force push.

    For your case the command will be:

    git push heroku `git subtree split --prefix website master`:master --force
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

We have got a web application and a windows forms application. The web application
I got a chat application (webservice) running on a website hosted by a web
I have a web application(ASP.NET2.0 C#). Within it, I have a div that contains
i have got various custom datatypes in my web application to map some data
I am creating a web chat application using asp.net vb. I have got the
I have got a Web application say A which via url needs to communicate
Hi Again Masters Of The Web :) Now, I have got a new stupid
We have a non-profit web site that got about 5 million hits in May.
I have the following problem. I got two forms on my web page. On
Let's say I'm using git locally only, for web work in JavaScript. I've got

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.