Skip to main content

I'm in an environment where the default branch is staging and I'm attempting to run a git merge.  However, in actioning this command, I'm been greeted with the following response 'not something we can merge'

❯ git merge origin/{branch}
merge: origin/{branch} - not something we can merge

To resolve this, first I attempted to do a git checkout to the branch

But this was swiftly meet with "did not match any file(s) known to git"

git checkout {branch}
error: pathspec '{branch}' did not match any file(s) known to git

 

Git hasn't 'seen' the new branch.  This is where git fetch comes into play.

❯ git fetch origin {branch}
remote: Counting objects: 9, done.
Unpacking objects: 100% (9/9), 721 bytes | 103.00 KiB/s, done.
From https://git-codecommit.ap-southeast.amazonaws.com/v1/repos/{name}
 * branch                {branch} -> FETCH_HEAD
 * [new branch]          {branch} -> origin/{branch}

With the branch recognised

❯ git checkout {branch}
branch '{branch}' set up to track 'origin/{branch}'.
Switched to a new branch '{branch}'

Switch back to your original branch that you wanted to merge.  In my situation I was staging

❯ git checkout staging
Switched to branch 'staging'
Your branch is up to date with 'origin/staging'.

Now I can merge and with success.  Try again. to run git merge

❯ git merge origin/{branch}
Auto-merging web/themes/custom/{project}/... {file path to change(s)}
Merge made by the 'ort' strategy.
 web/themes/custom/{project}/{file-path-to-change} | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

 

Related articles

Andrew Fletcher16 Jan 2025
get IP address from terminal OSX
When troubleshooting network issues or configuring devices, knowing your IP address can be essential. Whether you're connected via Wi-Fi, Ethernet, or tethering through a mobile provider, macOS offers powerful built-in tools to quickly identify your IP address. Here's a practical guide tailored to...