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 8339575
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T04:55:11+00:00 2026-06-09T04:55:11+00:00

Can someone please provide a simple example of what would cause a Git push

  • 0

Can someone please provide a simple example of what would cause a Git push to a central repo to fail because a fast forward could not occur? What would the local repo vs the central repo’s state need to look like in order for this to occur? Really having trouble visualizing 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-09T04:55:13+00:00Added an answer on June 9, 2026 at 4:55 am

    I assume you’re seeing this problem:

     ! [rejected]        master -> master (non-fast-forward)
    error: failed to push some refs to '/Users/mayoff/t/test/central'
    To prevent you from losing history, non-fast-forward updates were rejected
    Merge the remote changes (e.g. 'git pull') before pushing again.  See the
    'Note about fast-forwards' section of 'git push --help' for details.
    

    Here’s how the “non-fast-forward updates were rejected” problem happens.

    Let’s say Alice and Bob are working on a project. They each have a repository, and there’s a central repository they both push to and pull from. Initially, the three repositories look like this:

    initial synchronized repos

    Now Alice and Bob both do some work. Each commits a different change to their local repository:

    private repos have new commits

    Next, Alice pushes her change to the central repo:

    central repo updated by Alice

    Next, Bob tries to push. The central repo’s master branch points at commit 3. Bob’s push tries to update it to point at commit 4. Since commit 4 doesn’t have commit 3 as an ancestor, a merge is required, but git push doesn’t do real merges. It only does “fast-forwards”, where the new master has the old master as an ancestor. So Bob gets the error because he’s trying to push something that requires a real merge, not a fast-forward.

    To push successfully, Bob has to first fetch the new commit from the central repo:

    Bob has fetched Alice's commit

    and he has to merge his changes (commit #4) with Alice’s changes (commit #3), creating a new commit that has both commits as ancestors:

    Bob has merged the commits

    The fetch and merge can be done in two commands (git fetch followed by git merge) or in one command (git pull).

    Now Bob can push successfully, because the central repo sees that the new master has the old master as an ancestor.

    Bob pushed the merge

    Notice that now Alice is missing Bob’s commits. If she makes more commits to her repo and tries to push before pulling from the central repo, she’ll get the non-fast-forward error, and she’ll have to fetch and merge to fix it, just like Bob did.

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

Sidebar

Related Questions

Can someone please provide a simple example of how to consume a REST service
Can someone please provide an example of how to store, and read xml data
Can someone please provide an example on how to use plural forms in a
I'm new to this kabeja package so please can some one provide code example
Can someone please provide me or link for sample project with standard java rmi
Can someone explain in simple terms what is Key-Value-Coding and Key-Value-Observing ? Please don't
Can someone post a simple example of a JSON POST request to an API
For Chaining: Can someone please explain this concept to me and provide me a
Can someone please tell me what this means: 07-04 09:54:38.048: I/DetailActivity(15496): Title that is
Can someone please explain why ?___SID=U is appearing in some Magento URLs on my

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.