Andrew Fletcher published: 21 June 2023 2 minutes read
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 Fletcher
•
16 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...
Andrew Fletcher
•
07 Jan 2025
Managing DDEV environment troubleshooting and setting up multiple Drupal projects
DDEV has become a popular tool for local web development, offering a streamlined approach to managing Docker-based environments. However, setting up and managing DDEV projects, particularly with the latest versions of Docker Desktop, can present challenges. This article guides you through resolving...
Andrew Fletcher
•
28 Dec 2024
Optimising file transfers by improving efficiency from cp to rsync
Transferring files between development and production environments is a critical task in the deployment process. However, I continue to come across multiple approaches that scale from awesome automation using pipelines to the basic of direct command line entry. Where the basic approaches rely on...