Intellipaat Back

Explore Courses Blog Tutorials Interview Questions
0 votes
2 views
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

Here 

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.

31k questions

32.8k answers

501 comments

693 users

Browse Categories

...