Improve your coding skills and expand your career opportunities with courses in web development, Python programming, data science, and web design. Learn practical applications through hands-on classes and step-by-step workbooks.
Key Insights
- Pulling changes from a remote Git repo involves navigating to the folder for your Git repo and running the command 'git pull'.
- If you encounter a message about entering a commit message and want to exit, press ':' to enter command mode, 'q' for quit, and finally hit 'Return' (Mac) or 'Enter' (Windows).
- It's advisable to pull changes before you start to work (to have the latest changes) and before you push (in case something has changed while you worked).
- Doing a 'git pull' effectively runs 'git fetch' (which downloads latest changes from the remote repo) and then 'git merge' (which merges them into your local codebase).
- If you want to review the changes before merging the code, you can do a 'git fetch' instead of 'git pull'.
- Various programming courses are offered, including web development, Python programming, data science, and web design courses.
After someone else makes changes to a remote repo, you can download (pull) their changes into your local repo.
Pull Changes from a Remote Repo
1. In your terminal (Terminal, Git Bash, or Windows Command Prompt), navigate to the folder for your Git repo. 2. Run the following command:
Git pull
NOTE: If you get a message about entering a commit message and don't know how to get out of it, you're in Vim (a Unix command line editor). To exit, press : to enter command mode, then q for quit, and finally hit Return (Mac) or Enter (Windows).
When to Pull
It's a good idea to pull:
- Before you start to work (so you have the latest changes)
- Before you push (in case something has changed while you worked)
Fetch Changes from a Remote Repo
When you do a Git pull, behind the scenes Git is doing Git fetch (which downloads the latest changes from the remote repo) and then Git merge (which merges them into your local codebase). If you don't want to merge the code immediately (you may want to review the changes first), you can do a Git fetch instead of Git pull.
1. In your terminal (Terminal, Git Bash, or Windows Command Prompt), navigate to the folder for your Git repo. 2. Run the following command:
Git fetch
3. Now that you've downloaded the latest changes, you can compare your local branch to them. Assuming your on the master branch, you'd run the following command:
Git diff master origin/master
NOTE: If you're working on a different branch, change master (in both places) to your branch name.
Go Beyond Git
We offer the best coding courses and bootcamps for students at all levels of experience. Classes are hands-on and students receive workbooks with step-by-step instructions through exercises with real-world applications. Check out our programming courses now: