E
E
Evgeny Ivanov2021-07-09 09:57:30
git
Evgeny Ivanov, 2021-07-09 09:57:30

How to overwrite a repository in GitHub?

I created a new GitHub repository, cloned it, and started working (as usual).
I made the first commit, then the second, the third... I pushed all the commits to GitHub.

Then I realized that I made mistakes in the project. And I need to go back to the first commit.
And two commits above - permanently delete.

I enter the command git reset --hard f0a303c. And now I'm back to the correct commit, and the above commits are gone.
A local repository with one commit is fine.

But the commits remain on GitHub. And now GitHub Desktop offers me Pull Origin - i.e. upload the commits I deleted locally.
And if you do Push, then writes the following.
60e7f31285c61325166526.png
Fetch doesn't do anything (?) - i.e. Nothing changes either remotely or locally.

How to overwrite a repository in GitHub?
Not necessarily through GitHub Desktop, you can also through Git Bash.

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question