A
A
ADA M2018-11-29 09:20:17
git
ADA M, 2018-11-29 09:20:17

How to restore a branch from a merge?

Please tell me if it is possible to restore a branch that was not pushed to remote, but was merged with another remote branch.
For example, there are 2 branches dev and feature-3. The feature-3 branch was created locally and was not pushed to remote. Next, I merged the dev branch into feature-3 and pushed the dev branch to remote.
Is it possible now, from another device, to somehow remotely restore the feature-3 branch?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
J
jcmvbkbc, 2018-11-29
@adiletmurzaliev

there are 2 branches dev and feature-3. I merged the dev branch with feature-3 and pushed the dev branch to remote.
Is it possible to branch feature-3?

If the first half looked like this:
$ git checkout dev
$ git merge --no-ff feature-3
$ git push remote HEAD

or git merge feature-3at the second step, and the merge was not a fast forward, then the second half can be done like this:
$ git checkout dev
$ git pull remote dev
$ git checkout HEAD^2 -b feature-3

The idea is that <id-мёржа>^<N>this is the head of branch #N that participated in this merge.
If the merge was a fast forward, then dev and feature-3 are the same thing.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question