I created "my_branch
" while I was on "release
"
git branch my_branch release
So now I have this:
$ git branch
my_branch
master
* release
I do some adds and commits. Then, I want to push my_branch
, but I expect it to be at the same level as release
, and not at the origin / HEAD
. But that's what happen, if I do:
git push origin my_branch
What is the correct command to have "my_branch
" out of "release
" ?
--------------------------- EDIT
If I do my add/commit after a first push:
git push origin my_branch
git checkout my_branch
git add myfile.txt
git commit -a -m"toto"
git push
fatal: The current branch my_branch has no upstream branch.
To push the current branch and set the remote as upstream, use
git push --set-upstream origin my_branch
--------------------------- EDIT 2
git branch my_branch release
git push origin my_branch
git checkout my_branch
git add myfile.txt
git commit -a -m"toto"
git push origin my_branch
This works. It is showing up as a fork out of release after the first push in gitlab. After the second push, the commits is shown as head, ahead of master. I now understand what is hapening looking at the gitlab view. The original scenario at the top actually works but I had trouble interpreting it.