-
Notifications
You must be signed in to change notification settings - Fork 2
How to synchronize local repository with the latest version on Github
Greg Wong edited this page Sep 16, 2017
·
5 revisions
Warning: Keep a local copy of your current version or commit it to your personal repository as this method will overwrite all files in your local repository.
Whether you are using Github desktop or git, if you ever come across situations where you cannot fetch the origin as the files were updated (e.g., you are working on your-branch-1 and origin/your-branch-1 has been changed), here is a simple method you can use if you simply want to get the latest files from any branch in your Github repository without saving your local changes.
- Install Git on your computer
- Go to the directory of the Github folder
- Run the following command:
git reset --hard HEAD - Now, you will have the latest files downloaded from your branch on Github. All the old files are overwritten.
- Sample repository name: FreeCodeCampHongKong.github.io
