How to force git pull to overwrite local files

+1 vote

Hi Guys,

I have some files in the local Git as well as Github. One of my team members updated something on Github. Now I want to pull all the files to the local server. But how can I overwrite the previous data with new data?

Sep 4, 2020 in Git & GitHub by akhtar
• 38,170 points
390 views

1 answer to this question.

0 votes

Hi@akhtar,

First, you need to download the latest from remote without trying to merge or rebase anything using the below-given command.

$ git fetch --all

Then use the git reset command to reset the master branch to what you just fetched. But in this command, you need to use --hard option to change all the files in your working tree to match the files in origin/master.

$ git reset --hard origin/master
answered Sep 4, 2020 by MD
• 95,200 points

Related Questions In Git & GitHub

0 votes
2 answers

How to view the nested workflow of a local git repository?

The closest way to view branches in ...READ MORE

answered Aug 2, 2019 in Git & GitHub by Sirajul
• 59,070 points
410 views
0 votes
1 answer

Error: git pull fails “unable to resolve reference” “unable to update local ref”

This happens when there are unnecessary files ...READ MORE

answered Jul 26, 2018 in Git & GitHub by Sophie may
• 10,550 points
10,423 views
0 votes
1 answer

How to get the files from the local desktop to the local repository?

Hey @Ali, Follow these steps to transfer ...READ MORE

answered Dec 17, 2018 in Git & GitHub by Arohi
152 views
+15 votes
2 answers

Git management technique when there are multiple customers and need multiple customization?

Consider this - In 'extended' Git-Flow, (Git-Multi-Flow, ...READ MORE

answered Mar 26, 2018 in DevOps & Agile by DragonLord999
• 8,450 points
1,124 views
+2 votes
1 answer
0 votes
1 answer
0 votes
1 answer

How to configure git send-email in local system?

Hi@akhtar, To use git send-email service you have ...READ MORE

answered May 4, 2020 in Git & GitHub by MD
• 95,200 points
426 views