-
Notifications
You must be signed in to change notification settings - Fork 2
How to synchronize local repository with the latest version on Github
Andrea Law edited this page Sep 15, 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 master branch files were updated, 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 commands (replace your-branch-name with the real branch name)
git stashgit stash dropgit checkout your-branch-name - 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
- Sample branch name: issue-17-andrealaw
