Coding⏱️ 2 min read📅 2026-06-03

How to Fix: Git pull after forced update

Git pull after forced update: fix the merge conflict by using git reset --hard and git push -f again.

Quick Answer: Use `git reset --hard` to discard local changes, then `git push -f` to force-push your updated branch.

After performing a forced update with git push --force, you may encounter issues when other team members pull the updated repository. This is because their local repositories have a different commit history, which can lead to conflicts during the pull process.

💡 Why You Are Getting This Error

  • When you use git rebase to squash commits, it modifies the commit history of your repository. When you force-push this updated history with git push --force, other team members' repositories are not aware of these changes.

🔧 Proven Troubleshooting Steps

Method 1: Resetting the Repository

  1. Step 1: Run git reset --hard to discard any local changes and reset your repository to its latest commit.

Method 2: Reconciling with the Remote Repository

  1. Step 1: Run git fetch to update your local repository's knowledge of the remote repository's commits.

🎯 Final Words

To avoid similar issues in the future, consider using git push --force-with-lease instead of git push --force, which allows you to specify a commit hash or range that must be present on both your local and remote repositories before pushing is allowed.

Did this fix your problem?

If not, try searching for specific error codes.

🔍 Search Error Database

❓ Frequently Asked Questions