Git renames
One of the things that I like about Git is that I don’t have to think about operations that I make in my source. For example, I am working on the refactoring from NH Prof to ÜberProf, and I wanted to change the directories & project files. So I just went to explorer and renamed them.
Then I had to fix some namespaces references in the project file. It looks like this:
Notice that it capture both the rename and the content change?
You can also see how it looks in the log file:
Trying to do stuff like that with SVN is just PITA, with Git, I didn’t have to think about it.
Comments
Nice! Thanks for answering my question :)
So, you're using TortoiseGit, it seems. Are you using the command line as well or does Tortoise do everything you need?
TortioseSVN -> rmb -> rename (will rename in repository)
Git rename detection is a killer feature, no doubt about that. The lack of this in SVN was one of the main reasons you needed some form of IDE/environment integration.
I am using a mix of tortoisegit and the cmd line.
I like tgit for viewing the log.
Frans,
Yes, you can do renames in SVN.
But you have to use a special command and it is just plain harder.
I like the idea of using heuristic to rediscover renames, however git keeps stabbing me in the back during merges, attempting to merge completely unrelated files but not the one it should.
Combine that with an inteface that provides almost no abstraction over its internal workings I must say git is not the tool for me.
Mercurial has a superior approach to renaming IMHO: You can use heuristic to discover renames before commits and explicitely control and accept them.
The only way I can stand doing substantial renaming and moving with SVN is by using AnkhSVN from within Visual Studio.
Funny, I just did a rename of a class in Xcode, and since objective-c has header files, the content of the files changed as well:
import "oldfile.h" became import "newfile.h"
git did NOT detect this as a rename. I was quite surprised. Instead it looked like a delete oldfile, add newfile.
Exactly the same happened to me here :-) But it happened to me in other occurences too.
Actually, renaming and organizing stuff is when I really love working with TFS (gasp!).
Why would I ever want to rename files outside of Visual Studio?
Renaming the file usually means also renaming the class in the file. If I do it within VS, Resharper will just take care of that for me...
Moving files around usually means also updating the namespace to match the new location - again, I'll want my IDE (well, Resharper again) to make that a less painfull operation.
I see a lot of cool stuff when it comes to git (the whole distributed source control story) - but I don't really get this desire people have to separate their source control from their IDE.
The "desire" comes to the point of not wanting to use, or be locked to TFS. AnkhSvn will help you with this against SVN.
Since there was not scm plugin for svn before Ankh, and there are no plugins for git, then you need to use separate tools
or sell your soul, and use.. tfs..
Comment preview