Domanda

I have two branches that look like this

o--o--A--B-C--D env1 (master), cherry-picking from env2
       \
        X--C--D env2 

Only different between these two branches is environment settings. I want to maintain these two branches because it's quite easy for me to just git checkout to switch between environments.

Now the problem is, git push allows env2, but rejects env1(master). So how do other people get latest commits(mostly cherry-picked from env2) from env1? P.S. I don't want to loose any history on either branches

È stato utile?

Soluzione

If git push is rejecting your commit, there's a good reason! Read the message. Chances are it's because someone else has also pushed to master since your last fetch. Pushing your state would throw away someone else's work. You need to fetch their changes, merge yours in, and then push the results.

git fetch
git checkout master
git merge origin/master
git push origin master
Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top