4
votes

I'm looking at using Git for local developer VCS support (this is for multi-diciplinary development).

Previous practice was that the top level directory would be renamed (and a zip copy kept) for each trial version. It was reasonably effective for 1-2 person teams. Beyond Compare was used between versions.

However a quick try applying Git to the method shows that it 'thinks' that files are deleted and new one created, rather than simply being on a new path.

Thus we have

\GIT-Dir  
  \.git
  \Master-with-updating-version-name1  
    \ProjectName  
      \Source  
        files.etc  

becomes

\GIT-Dir  
  \.git
  \Master-with-updating-version-name2  
    \ProjectName  
      \Source  
        files.etc  

and then

\GIT-Dir  
  \.git
  \Master-with-updating-version-name3  
    \ProjectName  
      \Source  
        files.etc  

Given that I will need to keep alive the old method during the transition, what are the options?
a/ How to get Git to realise that it is simply a path update?
b/ how to make sure that the lower level files become properly tracked & diff'ed?

I'm on Windows, using GitGui 0.13, and git 1.7.4.msysgit.0, and have GitExtensions 2.21 installed

2

2 Answers

3
votes

Git doesn't track renames, it retrospectively determines them as part of the log and show commands. You don't ever have to explicitly rename/move a file or directory using the git commands.

Renames are determined by a difference threshold, if there's been an addition and a deletion of a file and the content is sufficiently similar, then git will consider it a rename/move.

If you rename your directory outside of git, then do a git status, you'll see it's picked them up as a deletion. Now add them both to your index (git add -A will do it), you should now see it sees them as a rename.

2
votes

On the command-line, you'd rename a file or directory with git mv. Your GUI should have an option for this.