0

I'm working with a project in a directory called lucy with a Git subtree called lucy-web (cf. How can I list the git subtrees on the root?):

(venv) Kurts-MacBook-Pro-2:lucy kurtpeek$ git log | grep git-subtree-dir | tr -d ' ' | cut -d ":" -f2 | sort | uniq
lucy-web

I have two (relevant) remotes, origin and staging:

(venv) Kurts-MacBook-Pro-2:lucy kurtpeek$ git remote -v
origin https://github.com/startwithlucy/lucy.git (fetch)
origin https://github.com/startwithlucy/lucy.git (push)
staging https://git.heroku.com/lucy-staging.git (fetch)
staging https://git.heroku.com/lucy-staging.git (push)

On origin, there is also a branch called staging:

(venv) Kurts-MacBook-Pro-2:lucy kurtpeek$ git status
On branch staging
Your branch is up to date with 'origin/staging'.

In the lucy-web subtree, I'd like to push the contents of origin/staging to the master branch on the staging remote. Usually, I do that with this command, which is now yielding an error:

(venv) Kurts-MacBook-Pro-2:lucy kurtpeek$ git push staging `git subtree split --prefix lucy-web staging`:master
cache for 09dc1ce7e3b490f30ceeabbca0c9375e2013b596 already exists!
To https://git.heroku.com/lucy-staging.git
 ! [rejected] 07fb260ddaeee35ef1c798c97dbe5e35d882bdbe -> master (fetch first)
error: failed to push some refs to 'https://git.heroku.com/lucy-staging.git'
hint: Updates were rejected because the remote contains work that you do
hint: not have locally. This is usually caused by another repository pushing
hint: to the same ref. You may want to first integrate the remote changes
hint: (e.g., 'git pull ...') before pushing again.
hint: See the 'Note about fast-forwards' in 'git push --help' for details.

It seems to me that what I need to do is merge the master branch on the staging remote into origin/staging before I can push, is that correct? If so, with what command can I do this?

asked Apr 10, 2018 at 23:31

1 Answer 1

1
git fetch staging master:master
git merge master
answered Apr 11, 2018 at 9:20
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.