Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to completely replace code in a git repository

Tags:

git

heroku

I have a Facebook application on my local machine and another created with Heroku (the code in the Heroku application was created automatically by Heroku). I'd like to completely replace the code within the Heroku application with the code on my local machine. I've already initialized a git repository in the directory on my machine where the code is and I've set the URL with git remote add origin [email protected]:my-fb-app.git. However, when I type in git push origin master I get:

To [email protected]:my-fb-app.git
 ! [rejected]        master -> master (non-fast-forward)
error: failed to push some refs to '[email protected]:blooming-cove-5867.git'
hint: Updates were rejected because the tip of your current branch is behind
hint: its remote counterpart. Merge the remote changes (e.g. 'git pull')
hint: before pushing again.
hint: See the 'Note about fast-forwards' in 'git push --help' for details.

Obviously, this isn't the right approach. How should I go about doing this?

like image 848
Johnny Avatar asked Oct 12 '12 14:10

Johnny


People also ask

How do I completely reset a git repository?

If you want to restart a git repo, nuke the . git directory and do git init add your files/directories and commit.

How do I remove a code from my GitHub repository?

Browse to the directory in your repository that you want to delete. In the top-right corner, click , then click Delete directory. Review the files you will delete. At the bottom of the page, type a short, meaningful commit message that describes the change you made to the file.


1 Answers

you could force it

git push -f origin master

taken from https://devcenter.heroku.com/articles/git

like image 61
Nick Ginanto Avatar answered Sep 29 '22 21:09

Nick Ginanto