1

this is my issue: I have 2 branch, master and deploy, I want work on master branch and on finish bring my changes to deploy branch and push it to remote repository. I tried this way:

git branch deploy 

now I have 2 branch, first commit on master branch:

git commit -a -m "first commit" 

bring the changes to deploy repository:

git merge deploy 

go to deploy branch:

git checkout deploy 

push the changes:

git push origin deploy 

but the merge command does not give me the expected result.

Any advice?

Thanks in advance!

1
  • 1
    what is the expected result? and what is the actual result? Commented Oct 15, 2018 at 19:32

1 Answer 1

1

According to the description of the workflow you put along the Git commands, it seems that you are using git merge in the reverse way.

Indeed, git merge a-given-branch basically means "integrate a-given-branch into the current branch (creating a merge commit if need be)".

Thus, your proposed workflow should read:

git branch deploy 

now I have 2 branch, first commit on master branch:

git commit -a -m "first commit" 

go to deploy branch and import the changes from master:

git checkout deploy git merge master 

push the changes to deploy repository:

git push origin deploy 

For more details on the git merge command, see also the online documentation.

Sign up to request clarification or add additional context in comments.

2 Comments

An opinion, I think that the description "import the commits from..." will confuse things further, as that's not what happens. A merge is a commit which references two parent commits rather than one.
Thanks @evolutionxbox; admittedly my initial phrasing could be somewhat misleading. But on the other hand a git merge don't always lead to a merge commit (it can lead to a fast-forward merge). Anyway I rephrased the sentence at stake to make it clearer.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.