Q:

Safe way to merge my branch

I have master branch
and I have xx1 branch with 3 commits ahead (changes in file A) and 5 commits behind master (changes in file B)
What is the safe way to merge xx1 branch to master branch ?
should I merge first master to xxx1 ?
or because files are different I can just merge my branch to master ?

A:

Theoretically yes. You can merge and there might not be any merge conflicts as you said the files are different. 
However, you can also rebase, which is a better option in my opinion. Rebase will make sure that all the commits are maintained individually.
https://git-scm.com/docs/git-rebase

