tags:

views:

64

answers:

3

Hi,

I had solution which consisted of two projects - ProjectName and ProjectName v2.0 At the beginning I didn't use the version control so I duplicated everything (copied Project name and named it ProjectName v2.0). After a while I started to use Git and added the folder v2.0 (Git add "ProjectName v2.0"). Later on I deleted the original folder (ProjectName) and renamed ProjectName v2.0 to ProjectName.

Now when I run Git it displays notifications:

deleted:....

Does anyone know what is the best way to reorganize the repository in order not to display these messages in this case?

Thanks!

+1  A: 

You can't avoid "deleted" messages if you delete things from a repository :-)

What you should have probably done (although it would now require some fairly major tree surgery) is replaced all of the files from ProjectName with those from ProjectName v2.0. If you started v2.0 while still working on v1, then you'd need to branch at the point you started 2.0. All in all, it would be fairly awkward to try to fix, especially if commits need splitting or re-organising, and if there's no clear path between v1 and v2.

Dave
A: 
Mark Carey
A: 

When you deleted v1 and renamed v2, did you do 'rm -r ProjectName' and 'mv ProjectName2.0 ProjectName' or did you do 'git rm -r ...' and 'git mv ...'?

It sounds like the former, in which case you need to update git to tell it that you've made all the changes. One way to do this would be to do 'git add ProjectName', followed by 'git add -u'. This will ensure that the index is updated such that 1: all added or deleted files in ProjectName are recognised, and 2: all modified or deleted files in the entire repository are recognised.

Alternatively, 'git add -A' will make sure that the index reflects the current state of the working directory, unless you have any suggestions in your .gitignore file.

Having updated the index, you can commit as normal.

If you are having trouble understanding the concept of the index in git, and the way in which file addition/removal is different to simpler VCSs which don't have that concept, you might try reading http://git.or.cz/gitwiki/WhatIsTheIndex or, if you have more time, http://tom.preston-werner.com/2009/05/19/the-git-parable.html. The latter refers to the index as the 'staging area', which is a colloquial term that's becoming quite common as many people find it a more descriptive name.

Nye