Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there any provision for converting .cvsignore files to .gitignore file?

I am using cvs2svn-2.4.0 for CVS to Git migration. This does not include the .cvsignore to .gitignore conversion. How do I convert .cvsignore files to .gitignore file?

like image 241
user2164525 Avatar asked Jun 03 '14 07:06

user2164525


People also ask

How do I ignore an already committed file in Git?

If you want to ignore a file that you've committed in the past, you'll need to delete the file from your repository and then add a . gitignore rule for it. Using the --cached option with git rm means that the file will be deleted from your repository, but will remain in your working directory as an ignored file.

Can I Git locally ignore?

A local . gitignore file is usually placed in the root directory of a project. You can also create a global . gitignore file and any entries in that file will be ignored in all of your Git repositories.

What should be included in Gitignore?

gitignore should list the names or name-patterns of files that will be found in work-trees when working with your project, but that should not be committed to the project. In other words, it's not OS-specific, it's project-specific.


1 Answers

Here's a Bash script which will look at the .cvsignore files in the directory tree and add their patterns to the top-level .gitignore file. It expects that the .cvsignore files contain only one pattern per line (apparently .cvsignore files allow multiple patterns in one line):

for f in `find . -name .cvsignore | sort `; do
    dir=`dirname $f | sed -r 's:^\.::'`
    cat $f | awk '{print "'$dir'/"$1}' >> .gitignore
done

In addition you have to add the default CVS ignore patterns from http://ximbiot.com/cvs/manual/cvs-1.11.23/cvs_18.html#SEC191.

like image 135
oliver Avatar answered Oct 18 '22 08:10

oliver