Reputation: 941
I had a git repo called chess_assess
.
chess_assess2
and copying almost all content from chess_assess
into it.chess_assess
and renamed chess_assess2
to chess_assess
.git remote add origin <path_to_chess_assess.git>
git add . && git commit -m ""
git push -u origin main
This produced the error
! [rejected] main -> main (non-fast-forward)
error: failed to push some refs to 'https://github.com/hexaquarks/chess_assess.git'
So I did:
git push -u origin main --force
which worked, but now my GitHub repo commits history is completely gone.
Is there a way to reobtain the commit history of my project while simultaneously connecting this new project to GitHub?
Upvotes: 2
Views: 268
Reputation: 1328262
How can I use reflog in the deleted branch when the initial folder chess_assess is deleted?
You cannot indeed.
If the remote repository remained the same, check its own remote reflog for GitHub, using the GitHub Event API to list push events. I mentioned those here, knowing that public events are delayed by a few minutes.
You might get the last pushed commit, which you can then fetch, bringing with its all its past commits.
Upvotes: 1