How to resolve git’s “not something we can merge” error.

Sahil Ali
2 min readJan 22, 2024

--

If you’re trying to merge two branches and you see the message “not something we can merge,” it suggests that Git is unable to automatically perform the merge due to conflicts between the branches. Here’s a step-by-step guide on how to resolve this situation:

Photo by Yancy Min on Unsplash

1. Fetch Changes:

Make sure you have the latest changes from both branches:

git fetch origin

2. Checkout the Target Branch:

Switch to the branch where you want to merge the changes. This is often the main or master branch:

git checkout main

3. Merge the Source Branch:

Attempt to merge the changes from the source branch into the target branch:

git merge source-branch

Replace source-branch with the name of the branch you want to merge into the target branch.

4. Resolve Conflicts:

If there are conflicts, Git will stop and indicate the files where conflicts occurred. Manually resolve the conflicts in each file marked by Git. Open the conflicted files in your text editor and look for lines with conflict markers (<<<<<<<, =======, >>>>>>>). Edit the file to resolve the conflicts.

After resolving conflicts, mark the files as resolved:

git add <conflicted-file1> <conflicted-file2> ...

5. Complete the Merge:

Continue the merge process:

git merge --continue

6. Commit the Merge:

If the merge is successful, Git will prompt you to create a commit message for the merge:

git commit

7. Push the Changes:

Finally, push the merged changes to the remote repository:

git push origin main

Note:

  • If you’re unsure about which branch to merge or are dealing with conflicts, consider using pull requests on GitHub. They provide a convenient interface for code review and merging.
  • It’s essential to communicate with your team during the merging process to ensure everyone is on the same page.

This process assumes that you are merging changes from source-branch into main. Adjust branch names accordingly based on your specific scenario.

--

--

Sahil Ali

SDE || Exploring New Technologies & Science || Useful Website & AI Tools || Resolving Error | https://www.linkedin.com/in/sahilali20/