If I’m rebasing my feature-branch unto main, I’m essentially moving the commits in my feature-branch on top of main so my branch catches up to the latest changes.

When running into conflicts, you’ll have to resolve the differences by editing the conflicted files.

% [feature-branch] git rebase main # Start rebase
% [feature-branch] git status # See which files are part of the commit
% [feature-branch] git diff # See the diff of the conflicting files
# Open files and resolve conflict, then save those files
% [feature-branch] git add file-with-conflict.rb # Stage file
% [feature-branch] git rebase --continue
  • The HEAD refers to the main branch.
  • The “current change” refers to the main branch.
  • The “incoming change” refers to the feature-branch changes that are coming to main.

Sometimes, you’re resolving a conflict on a file where it makes sense to accept all changes from main or your feature branch.

Accepts incoming changes from your feature-branch
git checkout --theirs .
git add .
git rebase --continue
Accepts current changes from main
git checkout --ours .
git add .
git rebase --continue