2
They
162d

I have no clue what I just did.

2 months ago I changed my repository name and today when I attempted to pushed an update I realised I had to update my remote key. Which I did.

Now..my repository now contains someone else's repository and my entire code base is non-existent.

Slightly pissed off that I'm now having to redo the entire work again but at same time I'm kinda amused on how I did this.

Comments
  • 0
    What? Can you please elaborate how exactly that happened
  • 0
    Is that you are viewing on different branches of the repo? Check the commits, nothing can just vanish.
  • 0
    Changed the github repository name.
    Deleted old remote keys.
    Added new remote key (pointing to the same repository but with updated name)

    Tried to push, got an error:

    Updates were rejected because the remote contains work that you do hint: not have locally.

    Forced pushed (push successful)

    Rechecked my repository and its now showing the cloned version of a repository I cloned 2-3 months ago. All updates I have done since the is gone.
  • 0
    @buitrung everything has vanished
  • 0
    @They why would you do a force push in that situation
  • 1
    @They force push i basically saying "yeah i don't care what happens, i just want this to be there"
  • 1
    @11000100111000 yeah, I just wanted it to be there. Didn't expect that would cause this situation I'm in. Lesson learnt I guess.. Never -f push unless you know what damages it will do..
  • 1
    @They I'm not sure how it happened, but when you rename the repo on git server, you should totally remove your current one in the local machine and clone the new one from git server. Your history is overridden now and there's no way back I guess...
  • 0
    @They you obviously wanted something else to be there 😉
  • 0
    @buitrung i don't agree tbh
  • 0
    If you're force pushing the master branch, you're probably doing something wrong and you should double check everything. Pretty much the only time that is correct is after rebasing a branch (which should never be done on master).
  • 0
    @They do a 'git reflog' and reply with the output

    You can revert a force push
  • 0
    @karasube thanks for trying to help! But I'm redoing the project now (it was just to learn react).

    The reflog returned the cloned repository I started off with if you wish to know.
Your Job Suck?
Get a Better Job
Add Comment