Pregunta

Situation: A local repository has branch A and branch B. Branch B is ahead of branch A by, let's say, 30 commits.

First question: Can I list all the commits that are in B that are not in A ?

Second question: Let's say I cherry pick some (completely random) commits from B into A. What will happen if after that I try to merge B into A? Will I get duplicated commits? Can this be avoided somehow?

¿Fue útil?

Solución

As for the first question,

git log --left-right --graph --cherry-pick --oneline B...A

to get a list of different commits between the branches.

After merging one branch with the other git will automatically keep only one copy of duplicate commits. In any case if any conflict, git will ask you to resolve it manually.

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top