1

I'm still new to git and github... well, I forked a plugin on github and made a few changes a while back. The owner added some of my changes, but github didn't show that my changes were merged. Since that time, a few other users have forked and updated the plugin.

Today I downloaded the latest forked version (not yet merged into the master), made my changes and tried to save them to my repository. The push was rejected and I got a "non-fast-forward" updates are rejected. Merge the remote changes...". Well then I did something really stupid - I deleted my github repository and forked the latest branch.

Now if I try to push I get the same error. I've reinitialized my git git init and tried to pull from the master git pull {name} master (from this SO answer) and I get a "fatal: ... git-pull cannot be used without a working tree". I've also tried the commands from SO answer and get the same error.

Is there anything I can do to fix this and push the lastest version?

Edit: Oops I used git pull not git remote add...

Community
  • 1
  • 1
Mottie
  • 84,355
  • 30
  • 126
  • 241

1 Answers1

4

A reject with non fast forward means that your local repository is not up to date and that you will have to do a merge locally before you can push again. You have to pull first.

Blizz
  • 8,082
  • 2
  • 33
  • 53
  • Try `git fetch`, then compare the output of `git log master` and `git log origin/master`. If the history looks the same, double-check that the SHA-1's on each commit are the same. – Amber Aug 01 '10 at 16:53
  • @Amber: Thanks, I see I have two commits (should only be one) with different SHA-1's. I tried using `git rebase --abort` but I got the same "without a working tree" error. – Mottie Aug 01 '10 at 16:59
  • You may want to save your changes somewhere outside your clone (via `git diff` or similar) and then just nuke your entire clone, re-clone, and re-apply your changes (`git apply`); it seems that your `git init` may have wiped out Git's knowledge that your current working directory is actually a checkout. – Amber Aug 01 '10 at 17:14
  • Thanks for your help! @Amber Thanks again, I basically just deleted everything and started over and finally got it working! – Mottie Aug 01 '10 at 20:58