I'm trying to list all changed files inside branch FEATURE-1 ignoring it's merge commits to the branch DEV, from which it was originally created using git diff. So the graph looks like this:
x---y---z---w---feature
/ / /
---a---b---c-+-d-+-e---dev
and when i'm on y commit, and type
git diff --name-only dev...feature
i get right what i need. But after merging feature branch into dev, imagine we are on w now, using this command i get blank output. So i need to exclude somehow all merge commits from git diff. Is there any way to exclude such commits? thanks in advance.
I use git version 2.21.0.windows.1 Windows 10, for local project
Outdated answer (see comments)
Just reference the commit before the merge instead of dev
git diff --name-only <commit e>...feature
(if the merge commit is the last one on dev
, you can just use HEAD^
instead of first searching for the hash in the branch's log)
Edit after comments:
It seems your graph is more like this:
X---Y---Z <<< feature
/ \ \
A---B-------C---D---E <<< dev
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.