Learn how git works first, then get a decent mergetool for it and start merging the different branches. There will be some conflicts that the mergetool can’t automatically resolve, so you need to guide it through those.
How I do it: I add nvidia repo as my unrealengine fork’s remote, I fetch nvidia and epics own repo changes, start with clean official release-tagged ue4 base and then I merge whole nvidia tech branches with squash-option so they only make one commit each (for later individual bug fix commits I just use cherry-pick).
If the nvidia branch isn’t for the same main ue4 version, it requires you to manually updade some files. In nutshell, that usually means you doing the engine compile and see what is missing or changed, fix the issues and finally commit a fix for that. Additionally, step involves fixing things that have changed in UE4 build system, so you change related Build.cs accordingly (just observe the diff from other plugins between the engine version you are upgrading from and into).