Divergent branches reconciliation
When working with local and remote branches in Git, you might encounter this error when pushing or pulling from the remote (GitHub).
#What happened?
- Your local branch and the branch on GitHub (remote branch) have different changes.
- Git doesn't know how to combine (reconcile) these changes.
#Why it matters?
- You need to decide how to merge these changes so both branches are up to date.
#How to fix?
#1. Merge
Combine changes and keep all commits (default strategy).
#2. Rebase
Move your changes on top of the remote changes, creating a straight line of commits.
#3. Fast-forward
Only update if there are no new local changes.
#Summary
Choose a strategy (merge, rebase, or fast-forward) to update your branch.