Mailing List Archive


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [tlug] git and sub-directories



>> I notice I have a .git subdirectory in both the top directory and the
>> settings subdirectory. I guess I did "git init" in the settings
>> directory first, then added the parent directory later.
>>
>> So how do I (a git beginner) fix this mess? Just deleting settings/.git/
>> is bad as then I'd lose some commit history?

Thanks for the reply Stephen. Delay in replying is as I wanted to study
a bit more git in the hope of understanding your reply. I think I've
just about got it, but in the end I used git log in each directory and
decided to just recommit the most recent file from the top directory, then:
   rm -rf settings/.git

I only lost three commit comments and I decided I could live without them.

BTW, how do I post a bug report for git? After 10 minutes of googling
the closet I've got is posts by two other people complaining they cannot
find out how either.

Darren



> 
> It depends on what you want to do with your history, and how bad
> you want to keep it.  I assume you only have one branch in settings.
> If you have more than one you want to save, you'll need to specify
> each branch to fetch command separately.
> 
> First :-)
> 
> rsync -a top /tmp/saved.top
> 
> Then you could try (in top)
> 
> git fetch settings
> git rebase --root --onto master FETCH_HEAD
> 
> This will probably put all files in top/settings in top.  Then rm -rf
> settings, mkdir
> settings, and git mv all those files back into settings.
> 
> You could probably do some magic with filter-branch to avoid the ugliness of the
> git mv step, but I don't have time for that right now.  The idea is to
> use --tree-filter
> to mv the files, but that will require some non-trivial scripting to
> identify the right ones.
> 


-- 
Darren Cook, Software Researcher/Developer

http://dcook.org/work/ (About me and my work)
http://dcook.org/blogs.html (My blogs and articles)


Home | Main Index | Thread Index

Home Page Mailing List Linux and Japan TLUG Members Links