git - How can always ignore a file while merge -


i have configuration file different in 2 branches. want config file tracked inside each branch ignored when merging branches.

so, after merge 2 branches, file remains in each branch same before merging.

firstly, need create ours merge driver unless have one. this, run command:

 git config merge.ours.driver true 

this driver allow prefer destination branch's version of file during merge session.

secondly, let's call branches a , b.

on branch a, in directory of file, create file called .gitattributes line in it:

myconfig.conf merge=ours 

then add , commit .gitattributes file.

it'll make git keep a's version of myconfig.conf when merging b a. if need merge a b, repeat same steps b branch.


Comments

Popular posts from this blog

monitor web browser programmatically in Android? -

Shrink a YouTube video to responsive width -

wpf - PdfWriter.GetInstance throws System.NullReferenceException -