Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Ignore files/folders on merge

Tags:

merge

svn

I'm currently using SVN for versioning my software projects. On an ongoing project, I have the trunk, for client common features and specifications and branches, for client specific ones.

Is there any way to mark some files / folders that shouldn't be merge into branches each time I perform such operation?

like image 415
Rui Gonçalves Avatar asked Mar 04 '10 16:03

Rui Gonçalves


People also ask

How do I ignore merge conflicts?

The simplest way, if you have unmerged paths, use git merge --abort to abort the merge. This way your code will look the same as it was before trying to merge with some other branch...

How do I ignore files in a folder in git?

A . gitignore file is a plain text file that contains a list of all the specified files and folders from the project that Git should ignore and not track. Inside . gitignore , you can tell Git to ignore only a single file or a single folder by mentioning the name or pattern of that specific file or folder.


1 Answers

I don't immediately see a solution, but it would be easy enough to script something up. What I give you is not bug tested.

First you would make a list of directories that you would want exclueded. Called ~/.svn-merge-excludes

#regexes to exclude
./helpfiles/
./deploy_scripts/
./models/customer_integration

Then you would write another script to revert those directories in the branch after you merge the turnk into them.

#/usr/bin/bash
# I am assuming that you made the excludes based on the root directory 
# so that relative paths will work
for dir in $(cat ~/.svn-merge-excludes) ; do
    svn revert -R $dir
done

That should work. The big thing here is the '-R' option in the revert acting recursively on the directory. Therefore your workflow will look something like.

# cd path/to/branch
# svn merge -r123:245 svn://svnserver.com/svn/trunk
# revert_excludes_from_branch.sh

Then you would handle the conflicts and then commit. If you are using windows then a batch file would work too, you could just type out the revert commands in series.

like image 76
flaxeater Avatar answered Oct 11 '22 17:10

flaxeater