Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

exclude file from merging

yallashopping yallashopping December 6, 2015

hi , 

i have two branches , the master and develop and we need to exclude some files from merging but  i still want to commit it but i do not want to merge it with master because it is include information related to development and not for production , i can not used ignore because i want to make change on it but all i need is exclude the files when merging or when pull request , is there any way to achieve that ?

 

Thanks

 

2 answers

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

Post a new question

1 vote
Seth
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
December 7, 2015

When you do the merge, you can choose to NOT auto-commit the merge. This will stage the merge results, and you can go through the staged changes and discard the changes to the files in question.

You'll have to do this manually every time, because as Mike said, Git isn't designed to treat files individually.

A different option is to ignore those files, and store copies in a separate repo. My workplace has a "code" repo and a "documentation" repo, because most documentation was not branch-dependent, and we had to deal with unnecessary merge conflicts or out-of-date docs because changes had been commit to one branch but not merged to others.

1 vote
Mike Friedrich
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
December 6, 2015

No, that's not possible with any source control systems wich work on the whole work tree (instead of commit by file). Git is one of those.

You can look at merge strategies for certain file types, if it always the same files.

Mike Friedrich
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
December 6, 2015

Look for the manual about .gitattributes files.

TAGS
AUG Leaders

Atlassian Community Events