I would like to merge changes from a branch B to my branch A, in such a way that the merge excludes any changes to a given directory. The problem here is that I have some commits which span changes over multiple directories, one of which needs to be excluded.
Is something like that possible, for example, with history rewriting?
To clarify, my directory structure is:
root/x
root/y
root/z
some of the commits affect all three directories. Now, I would like to merge in such a way that I have changes in the history to both y
and z
, but not to x
.
You can merge the other branch without committing it, then resetting the state of the directory:
git merge --no-commit <branch>
git reset root/x
git commit
better yet to split your commits as mentioned by @useless in his answer
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With