V
V
Vova2017-07-20 13:05:18
git
Vova, 2017-07-20 13:05:18

How to find the branch from which the changes came?

Hello.
In the process of using git, I discovered a frequent case that prevents me from living.
There is a certain main branch (master), into which merge is periodically made from other (feature) branches.
How to look at a line in a file in the main branch to understand from which branch it was merged?
I tried git blame, but it says about the author. And I want to see not the author, but the branch in which each individual line was added. Well, or changed.
What is the easiest way to get results?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
M
ManWithBear, 2017-07-20
@ManWithBear

git log <Commit hash>..HEAD --ancestry-path --merges --oneline --color | tail -n 1

Example:
Bear-MacBook-Pro:MyApp ManWithBear$ git log c1c750c..HEAD --ancestry-path --merges --oneline --color | tail -n 1
8ec0203 Merge branch '9-filter-ui-implementation' into 'master'

via Eugen Konkov

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question