I have a git repository, where master is the current version of the application and each customer has their own branch with their own customizations.
I have cloned each customers branch separately into a directory using --single-branch
My goal is to merge master into my branch. I have cloned the repo using following command:
git clone {{REPO_URL}} --single-branch my-branch --branch my-branch
Then I tried:
git fetch origin -- master
git merge master
Then I am getting this
merge: master - not something we can merge
I know I could get around this by cloning entire repository, but is there anyway to work around this?
You just need to add the url as another remote in your local repo.
Detail commands as below:
# In local my-branch
git remote add upstream <repo URL> -f
git merge upstream/master
Now your local my-branch contains the changes from master branch.
Update: to add remote only for master branch, you can use the command:
git remote add upstream <repo URL> -t master -f
If you already add the remote upstream with all branches, you can change it by:
git remote rm upstream
git remote add upstream <repo URL> -t master -f
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With