Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8753177
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T13:22:45+00:00 2026-06-13T13:22:45+00:00

git fetch goes over the network and fetches the latest snapshot from origin/master to

  • 0

git fetch goes over the network and fetches the latest snapshot from origin/master to the local host. It does not merge but just fetches the snapshot. Right after git fetch if we do git status, it will tell us whether (local) master is ahead or behind origin/master.

All I want is a git command that will just tell us whether the content of (local) master is the equivalent of the content of origin/master. Obviously, it has to go over the network to determine that but it should not print any messages about its findings (like the output of git fetch or any other git command) and finally, just output only yes/true (if equivalent) or no/false (if different) or something similar.

Is there any git internal commands or api’s which could do this?!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T13:22:46+00:00Added an answer on June 13, 2026 at 1:22 pm

    I finally used the following snippet of code.

    output=`git fetch --dry-run 2>&1`
    
    if [ "$output" != "" ]; then
        echo "***********************************************"
        echo "*                    ERROR                    *"
        echo "* Your git source directory is not up to date *"
        echo "***********************************************"
    fi
    

    Had a problem parsing the output of git fetch --dry-run but found that the console messages belong to stderr Git: unable to redirect/parse the output of 'git fetch –dry-run' command

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Is it possible to config git repository not to fetch branches from certain namespaces
$ git branch master * portal $ git fetch $ git merge origin/portal Already
I was using the following procedure for a while: git fetch origin master git
Related question: why does Git send whole repository each time push origin master The
(let ((default-directory /home/vision/)) (magit-pull) (magit-fetch upstream) (magit-merge upstream/master) (magit-push)) I'm getting: Running git fetch
I've done something like following: (1) clone a remote git repository to local host
I have a remote repository and a local repo. I did a git fetch
I created a tracking branch so whowasout.com tracked whowasout.com/master $ git remote -v origin
When I do git fetch origin and origin has a deleted branch, it doesn't
What does the branch parameter mean when issuing git fetch <remote_repo> <branch> ?

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.