Languages
[Edit]
EN

Git - pull with force to override / reset local changes in history

2 points
Created by:
Creg
9600

In this article, we want to show how run git pull command overriding local changes.

Quick solution (on master branch):

 

Read the below sections to know much more.

 

Problem overview

Edit

Somene in team made changes in git history or we modified locally repositiry and we want to use code version from remote server.

Console example (in this case conflict occured):

 

Problem solution

Edit

Run git reset --hard with name of branch making sure you have current version of source code.

Recommended steps:

1. fetch current source code from remote repository using:

2. reset changes for specific branch using:

Note: git reset --hard origin/master if we work on master branch.

Console example:

 

Alternative titles

  1. Git - solution for pull with conflict
  2. Git - resolve git-pull conflicts
1
Donate to Dirask
Our content is created by volunteers - like Wikipedia. If you think, the things we do are good, donate us. Thanks!
Join to our subscribers to be up to date with content, news and offers.

Git

Native Advertising
🚀
Get your tech brand or product in front of software developers.
For more information Contact us
Dirask - we help you to
solve coding problems.
Ask question.

❤️💻 🙂

Join