1
0
mirror of synced 2026-01-01 09:04:46 -05:00
Files
docs/translations/ru-RU/content/github/using-git/dealing-with-non-fast-forward-errors.md
Chiedo John c116efe725 Crowdin translations (translation-batch-1604415979) (#16312)
* New Crowdin translations by Github Action

* Revert broken translated files to English

* Revert broken translations

* Revert broken translations

* Revert more broket translations

* Revert broken translation

* Increase Node memory limit for running Jest

* Allow Node to use more memory for Jest

* Increase Node memory limit for running Jest

Co-authored-by: Crowdin Bot <support+bot@crowdin.com>
Co-authored-by: Chiedo <chiedo@users.noreply.github.com>
Co-authored-by: James M. Greene <JamesMGreene@github.com>
2020-11-03 16:15:55 -05:00

1.5 KiB

title, intro, redirect_from, versions
title intro redirect_from versions
Dealing with non-fast-forward errors Sometimes, Git can't make your change to a remote repository without losing commits. When this happens, your push is refused.
/articles/dealing-with-non-fast-forward-errors
free-pro-team enterprise-server github-ae
* * *

If another person has pushed to the same branch as you, Git won't be able to push your changes:

$ git push origin main
> To https://{% data variables.command_line.codeblock %}/<em>USERNAME</em>/<em>REPOSITORY</em>.git
>  ! [rejected]        main -> main (non-fast-forward)
> error: failed to push some refs to 'https://{% data variables.command_line.codeblock %}/<em>USERNAME</em>/<em>REPOSITORY</em>.git'
> 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.

You can fix this by fetching and merging the changes made on the remote branch with the changes that you have made locally:

$ git fetch origin
# Fetches updates made to an online repository
$ git merge origin <em>YOUR_BRANCH_NAME</em>
# Merges updates made online with your local work

Or, you can simply use git pull to perform both commands at once:

$ git pull origin <em>YOUR_BRANCH_NAME</em>
# Grabs online updates and merges them with your local work