Skip to main content
  1. Learn
  2. Software Development
  3. Guides
  4. Git tutorial
  5. Git basics
  6. Syncing repositories
  7. Merging changes
GuidesSoftware DevelopmentBacklog

Project and code management together.

Merging changes

Your push to the remote repository will be rejected if your local repository is outdated.

Diagram of a ouddated repo.
You cannot push to the remote repository if your local repo is outdated.

When this is the case, you can use the git merge command to integrate the latest changes from your local copy of the remote branch before you push. Git enforces this to ensure that changes made by other members get retained in the version history.

Diagram of a merging latest changes.
You must merge the latest changes before pushing if your local repo is outdated.

During a merge, Git will attempt to automatically apply historical changes and merge them with the current branch. However, if there is a conflict, an error will prompt you to resolve it manually.

Subscribe to our newsletter

Learn with Nulab to bring your best ideas to life