Pull changesTo illustrate "git pull" make a modification to any file in your test repository and commit/push it.
Edit the file in the online editor:
Now let's fake a real world scenario; someone else is going to edit the README.md. To fake this, go to the Github or GitLab website and modify the file. Make a commit using the website. Don't create a new branch.
Pull the changes:
Now that someone else has modified the file, you may want to retrieve the changes as well.
This is how you retrieve changes:
You will get something similar to this:
git pull origin master
Take a look at the following line:
remote: Counting objects: 3, done. remote: Total 3 (delta 0), reused 0 (delta 0), pack-reused 0 Unpacking objects: 100% (3/3), done. From github.com:schipplock/test-repository * branch master -> FETCH_HEAD 0ca4277..9d7c096 master -> origin/master Updating 0ca4277..9d7c096 Fast-forward README.md | 1 + 1 file changed, 1 insertion(+)
You probably remember the 0ca4277; this is your initial commit. The 9d7c096, however, is the new commit from "someone else".
See the difference:
To see what has changed between your initial commit and this new one:
You will see a diff.
git diff 0ca4277 9d7c096