New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merge only missing keys #1038
Comments
Yep - documented here: https://mikefarah.gitbook.io/yq/operators/multiply-merge#merge-flags |
oh wait - you want the opposite right? only include new field and leave the existing 🤔 |
yes, I only want to include new fields and the leave the existing ones as they are. So basically, the opposite of the
|
Will have this functionality out (and documented) in the next release (next weekend eta) |
Ok I've released a new merge flag (n) https://mikefarah.gitbook.io/yq/operators/multiply-merge#merge-only-new-fields in 4.17.2 :) yq ea '. as $item ireduce ({}; . *n $item)' examples/data1.yaml examples/data2.yaml key1: Key1
key2: Key2
key3: Key3 |
First of all: Really appreciate the work on yq, it's a huge time safer for me!
This command from the docs merges everything from file2.yml into file1.yml
And this is
file1.yml
after the merge:My question is: Is it possible, to skip the overwrite for
key1: Overwritten Key1
/ is it possible to only merge new keys and not overwrite existing ones? The resulting yaml should look like this:The text was updated successfully, but these errors were encountered: