E
E
embiid2021-03-09 19:18:13
git
embiid, 2021-03-09 19:18:13

How to merge into a git-flow branch?

Briefly tell the situation:

1 - There is master -> README.md;
2 - Created a developer branch in the repository
3 - Created a developer branch in the feature -> feature_some1 branch

Problem:
1) On gitlab I see that I have master and feature/feature_some1 (BUT! no developer, it turns out that I didn’t push developer ?!) [Through git branch I see that there is a developer, that is, is it local?]

2) Now I wanted to merge feature_some1 to developer
(I get the error working tree contains unstaged changes. aborting. git flow)
[I understand that he does not want to merge, because are there any uncommitted files locally?]

Question:
1) How can I push deloper to gitlab/github ?
2) How can I create a new branch for feature_some2 ?
(Is it possible to do the same, so that feature would have both feature_some1 and feature_some2 ?)
[that is, now locally like this:
developer -> feature
feature -> feature_some1
want -> feature_some2
]

Answer the question

In order to leave comments, you need to log in

2 answer(s)
S
Sergey Kuznetsov, 2021-03-10
@embiid

1) By default, git push sends only one branch to the server - the current one. To push the developer
branch , first switch to it. Or you can not switch, but explicitly specify what and where to push . This command says: take the developer branch and push it to the origin repository . The -u flag is needed to immediately link local branches to the remote ones being created. Although you can tell git to push all local branches at once
git checkout developer
git push -u
git push -u origin developer

% git push -u --all 
Total 0 (delta 0), reused 0 (delta 0), pack-reused 0
To https://github.com/.../repo.git
 * [new branch]      developer -> developer
Ветка «developer» отслеживает внешнюю ветку «developer» из «origin».
Ветка «feature/feature_some1» отслеживает внешнюю ветку «feature/feature_some1» из «origin».
Ветка «feature/feature_some2» отслеживает внешнюю ветку «feature/feature_some2» из «origin».
Ветка «master» отслеживает внешнюю ветку «master» из «origin».

But if you have a local branch that you do not want to shine on the server, then the -all flag will not work))
2) The syntax of the name feature/feature_some1 is not two branches, feature and nested feature_some1
It is still one branch. But in graphical clients, such branches are displayed as nested ones, for convenience.
Having created the second branch with the name feature/feature_some2 we get the following picture
604841b7bfdc2368381419.png
But no feature branch exists.
% git branch    
  developer
  feature/feature_some1
* feature/feature_some2
  master

3) How to merge into the developer branch?
Before merging, make sure that the working copy has no uncommitted changes.
Either drop uncommitted changes or create a commit with them.
Otherwise, git doesn't know what to do with them and gives you an error.

D
Dmitry, 2021-03-19
@dlnsk

Do you need git-flow?
As far as I understand, you have almost no experience in git, but you are going to apply the enterprise solution right away. git-flow implies the use of releases . In this regard, a set of branches and their interaction is built. In the vast majority of cases, releases are not needed , which means the process will be different.
The simplified process was well described by an experienced person here: https://qna.habr.com/answer?answer_id=1552111#answ...
This works even if you have several people in your team, not to mention one developer. Checked on myself.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question