Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Git is ignoring .git directories in subdirectories

Tags:

git

backup

I'm using git as a backup tool and 'roaming profile' for my $HOME directory between laptop and desktop.

My problem is that under my $HOME I have a Development directory with multiple git projects I'm working on. Git will not allow me to add the subdirectories .git folders. So to commit to these projects I have to push the changes into my $HOME git repo, pull on laptop (where they were created and .git dir exsits) and commit.

I've read about submodules, but it's not really what I want. I just want the children .git folders to be treated like any old directory so I can move them around and back them up.

Has anyone done this or have an idea how I would?

like image 934
Danny Avatar asked Oct 25 '22 16:10

Danny


2 Answers

Don't do it. It's a bad idea because you are creating a versioned backup of a versioned repository. Just create a backup by rsync (you can still version the parent using git)

like image 115
iwein Avatar answered Nov 08 '22 08:11

iwein


I'm personally using git to sync some dot-files like .profile or .vimrc. To avoid problems like yours my git is located in $HOME/dot and the single files are symlinked in $HOME.

like image 30
Raphael Michel Avatar answered Nov 08 '22 09:11

Raphael Michel