Question

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?

Était-ce utile?

La solution

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.

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top