Git push branch error after pull rebase

step 1. git pull --rebase

step 2: git push origin my_branch

  • What is the difference between “git whatchanged — filename” and “git rev-list — filename”
  • Using a git repository as a website root folder
  • Git: I've a feature branch with 80+ commits. How can I safely merge it into develop/production without ruining the history?
  • Is there a tool to watch a remote Git repository on Ubuntu and do popup notifications when commits are made?
  • Can I map local branches to remote branches with different prefixes in git?
  • Find all the commits there are in lab branch but in master branch
  • I get push failed error. If I push branch after removing remote branch then no error.

    Question, how to push branch after pull rebase?

    Thanks

  • NetBeans + FTP + BitBucket
  • How can I undo a `git commit` locally and on a remote after `git push`
  • How do I get git to ignore my csv files?
  • firing a git hook on the client
  • Updating all repos in a folder?
  • .gitignore doesn't ignore files in subdirectories
  • 2 Solutions collect form web for “Git push branch error after pull rebase”

    Rebasing a branch in Git may involve rewriting the history of that branch, assuming that the bases of the two branches were different. From what you told us, it seems that you rebased on a different branch. Most likely, in your case, your my_branch was rewritten, which means you cannot simply push to the remote.

    To get around this, you can force push your branch via:

    git push --force origin my_branch
    

    However, you might not want to do this if the rebase on a different branch were unintentional.

    Instead, try rebasing this way:

    git pull --rebase origin my_branch
    # resolve merge conflicts, if any
    git push origin my_branch
    

    General warning:

    Force pushing a public shared branch is usually a bad idea, because it causes problems for everyone who shares that branch. If your current workflow involves doing this, you might want to reconsider.

    First of all you have to check the status of rebase process. If rebase is running push wouldn’t work. So git rebase –abort/ git rebase –skip to stop the rebase.
    Then try to commit any untracked files if any mismatch.

    Finally git push origin my_branch will work I think.

    Git Baby is a git and github fan, let's start git clone.