Explore Courses Blog Tutorials Interview Questions
0 votes
1 view
in DevOps and Agile by (29.3k points)

I need to throw away all the changes in my local repository and pull all the code from the remote repository. What is the Git command to do this?

1 Answer

0 votes
by (50.2k points)

You could use these commands

git fetch origin

git reset --hard origin/master


Origin is the remote repository

master is the branch 

These two commands are used to fetch the commits from the remote repository and positioning your working copy to the master.

And also all local commits that are not committed to the remote will be lost due to -hard option.

Browse Categories