How to Force the Git Pull Command

preview_player
Показать описание
Trying to force a Git Pull command from GitHub or GitLab?

This quick tutorial shows you the steps you need to take to perform the equivalent of a git pull force from a remote repository like GitLab, GitHub or BitBucket.

The steps are a bit unorthodox. From the repository in which you plan to run the git pull force command, you issue the following commands:

git stash
git branch backup-branch
git fetch --all
git reset --hard origin/main

In this case, we emulate the git pull force on master or main, but the same steps apply for any branch.

And be careful with other branches that may not share the same commit history as the main or master branch on which you forced the git pull. Like the backup-branch, you will no longer be able to merge back into master or main, as the git commit history will be out of step.

Good luck with your attempt to force a git pull!
Рекомендации по теме
Комментарии
Автор

Thank you for the great tips! This was the command I was looking for.

rad_gamer
Автор

thank you so much, it really helps me

amandagfrosa