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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T05:56:46+00:00 2026-06-13T05:56:46+00:00

I read the git book but somehow forgot the rule that says: Do not

  • 0

I read the git book but somehow forgot the rule that says:

Do not rebase commits that you have pushed to a public repository.

If you follow that guideline, you’ll be fine. If you don’t, people
will hate you, and you’ll be scorned by friends and family.

Here goes, at work I created a local branch feature-xyz which I pushed to the remote repo. I pull it on a different computer, did some more work and pushed. Back at work, I pulled the branch. After a few commits, I rebased my branch. Now I’m done with the feature-xyz and want to push it to the remote repository but this is obviously failing with the following message:

$ git push origin feature-xyz
To git@<url>:<repo>.git
 ! [rejected]        feature-xyz -> feature-xyz (non-fast-forward)
error: failed to push some refs to 'git@<url>:<repo>.git'
hint: Updates were rejected because the tip of your current branch is behind
hint: its remote counterpart. Merge the remote changes (e.g. 'git pull')
hint: before pushing again.
hint: See the 'Note about fast-forwards' in 'git push --help' for details.

Obviously pulling the remote branch creates all sorts of conflicts. So instead I decided to delete the remote branch:

git push origin :feature-xyz

and recreate it:

git push origin feature-xyz

However I was wondering if there’s a better workflow not involving deleting the remote branch?

  • 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-13T05:56:47+00:00Added an answer on June 13, 2026 at 5:56 am

    Don’t rebase then. Merge.
    Ie, don’t rebase feature-branch on top of anotherBranch. Merge anotherBranch into feature-branch.

    Note that deleting the remote branch or push --force the same branch is the same.
    In both case, you have published new SHA1, rewritten the history, which can be inconvenient for anyone else having previously pulled feature-branch.

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

Sidebar

Related Questions

I've read this book section about git branches. I have create a branch called
I have read this thread when I got the the git: command not found
I've read a few git questions here, but could not find an answer to
Basically I have read the git merge conflicts guide, and I'm not sure it
I have this repository that I'd like to share but not necessarily by putting
I've read the Basic Branching and Merging section of the Git Community Book. So
I read Gitbook it says git add file1 git commit -m ' second commit'
The guides I've read so far on Git say that I should go into
I'd read that when renaming files in Git , you should commit any changes,
Every piece of documentation I've read on git (including the online book and the

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.