How to update Git clone

Git

Git Problem Overview


I have started using Git. I have cloned the repo on my local system. I make the changes on the local machine and use git push to the update the remote repo. It works fine.

I have a quick query how to update my clone from the remote. I tried git remote update. It did not work, new changes does not appear. I just want to make sure I have recent copy of the repo before I get to work. How I can update the clone?

Git Solutions


Solution 1 - Git

If you want to fetch + merge, run

git pull

if you want simply to fetch :

git fetch

Solution 2 - Git

git pull origin master

this will sync your master to the central repo and if new branches are pushed to the central repo it will also update your clone copy.

Solution 3 - Git

In Android Studio its VCS then Pull then Master

Solution 4 - Git

In current GitHub nomenclature 'master' was replaced with 'main', so the command to use is git pull origin main

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionJosh RandallView Question on Stackoverflow
Solution 1 - GitGilles QuenotView Answer on Stackoverflow
Solution 2 - GitSyd PaoView Answer on Stackoverflow
Solution 3 - GitDaveView Answer on Stackoverflow
Solution 4 - GitPedro TavaresView Answer on Stackoverflow