/github-for-non-tech

How to understand the difference between push and pull?

Understand the difference between git push and pull with our step-by-step guide. Learn to set up repositories, commit changes, and resolve conflicts effortlessly.

Matt Graham, CEO of Rapid Developers

Book a call with an Expert

Starting a new venture? Need to upgrade your web app? RapidDev builds application with your growth in mind.

Book a free No-Code consultation

How to understand the difference between push and pull?

 

Step 1: Setting up Local and Remote Repositories

 

First, create a GitHub repository and clone it locally. You’ll use this setup to demonstrate both push and pull.

  • On GitHub.com, click “New” to create a repository named demo-push-pull.
  • Ensure it’s public (or private) and click “Create repository.”
  • Copy the repository’s HTTPS URL.

# In your terminal, clone the empty repo
git clone https://github.com/your-username/demo-push-pull.git
cd demo-push-pull

 

Step 2: Understanding Local vs Remote

 

Git tracks two main locations for your code:

  • Local repository: Files and commits on your machine.
  • Remote repository: The copy hosted on GitHub (commonly named origin).

Commands you run locally affect only your machine until you push to the remote. Commands that fetch or merge content from GitHub to your machine use pull.

 

Step 3: Making a Local Change and Committing

 

Create a file, add some content, and commit it. This prepares new work to send to GitHub.


# Create a README file
echo "# Demo Push Pull" > README.md

# Stage the change
git add README.md

# Commit locally
git commit -m "Add initial README"

 

Step 4: Pushing Local Commits to GitHub

 

git push sends your local commits up to the remote repository so others (and you on other machines) can access them.

  • origin refers to the default remote name.
  • main is the default branch name (might be master in older repos).

# Push your 'main' branch to the remote named 'origin'
git push origin main

After running this, visit GitHub.com to confirm your README.md is visible online.

 

Step 5: Simulating a Remote-Only Change

 

To illustrate pull, create or edit a file directly on GitHub:

  • On your repository’s page, click “Add file” > “Create new file.”
  • Name it remote.txt and add any text.
  • Scroll down, commit to main.

No changes have occurred on your local machine yet—you need git pull to fetch and integrate them.

 

Step 6: Pulling Remote Changes into Your Local Repo

 

git pull does two things: it fetches new commits from the remote, then merges them into your current branch.


# Fetch and merge remote changes
git pull origin main
  • You should now see remote.txt in your local folder.
  • The terminal output will show a merge summary if new commits were integrated.

 

Step 7: Handling Push/Pull Conflicts

 

Conflicts happen when both remote and local change the same lines. To simulate:


# Edit README.md locally
echo "Local edit" >> README.md
git add README.md
git commit -m "Local change to README"

# Meanwhile, edit README.md on GitHub UI and commit there
# Now try to push
git push origin main
  • The push will be rejected with a hint to pull first.
  • Run git pull origin main, then resolve conflicts in your editor:

# After resolving conflict markers in README.md:
git add README.md
git commit -m "Resolve merge conflict in README"
git push origin main

 

Step 8: Key Takeaways on Push vs Pull

 

  • git push: Send your local commits to the remote so others can see them.
  • git pull: Retrieve and integrate changes from the remote into your local copy.
  • Always pull first if you know others may have updated the remote to avoid rejected pushes.
  • Use git fetch + git merge separately if you want more control.

Want to explore opportunities to work with us?

Connect with our team to unlock the full potential of no-code solutions with a no-commitment consultation!

Book a Free Consultation

Client trust and success are our top priorities

When it comes to serving you, we sweat the little things. That’s why our work makes a big impact.

Rapid Dev was an exceptional project management organization and the best development collaborators I've had the pleasure of working with. They do complex work on extremely fast timelines and effectively manage the testing and pre-launch process to deliver the best possible product. I'm extremely impressed with their execution ability.

CPO, Praction - Arkady Sokolov

May 2, 2023

Working with Matt was comparable to having another co-founder on the team, but without the commitment or cost. He has a strategic mindset and willing to change the scope of the project in real time based on the needs of the client. A true strategic thought partner!

Co-Founder, Arc - Donald Muir

Dec 27, 2022

Rapid Dev are 10/10, excellent communicators - the best I've ever encountered in the tech dev space. They always go the extra mile, they genuinely care, they respond quickly, they're flexible, adaptable and their enthusiasm is amazing.

Co-CEO, Grantify - Mat Westergreen-Thorne

Oct 15, 2022

Rapid Dev is an excellent developer for no-code and low-code solutions.
We’ve had great success since launching the platform in November 2023. In a few months, we’ve gained over 1,000 new active users. We’ve also secured several dozen bookings on the platform and seen about 70% new user month-over-month growth since the launch.

Co-Founder, Church Real Estate Marketplace - Emmanuel Brown

May 1, 2024 

Matt’s dedication to executing our vision and his commitment to the project deadline were impressive. 
This was such a specific project, and Matt really delivered. We worked with a really fast turnaround, and he always delivered. The site was a perfect prop for us!

Production Manager, Media Production Company - Samantha Fekete

Sep 23, 2022