T
T
Tsuzukeru2020-07-24 19:28:27
git
Tsuzukeru, 2020-07-24 19:28:27

How to fix a commit if it's already pushed to GitHub?

Prematurely did git push origin MVVM . How to fix it?
Tried like this - git commit --amend --no-edit .
A conflict occurs:
hint: Updates were rejected because the tip of your current branch is behind
hint: its remote counterpart. Integrate the remote changes (eg
hint: 'git pull ...') before pushing again.
hint: See the 'Note about fast-forwards' in 'git push --help' for details.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
I
Ilya, 2020-07-24
@Tsuzukeru

git push --force
Do it consciously, especially if you're not alone in the repo.
Here's a good quote from the site about changing commits in a repo:

Don't move commits that have already been pushed to the public repository
. If you stick to this rule, you'll be fine. If you don't, people will hate you and your friends and family will despise you.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question