09-07-2021 11:55 AM
Hi, Everyone:
I know this isn't really a LabVIEW question, per se, but how do you go about renaming a binary file (like a VI) in GIT? To preserve things in LabVIEW, I do the renaming in there, but to GIT I deleted one file and created another. With SVN (with tortoise client) I was able to "repair" the two files, which transferred the history of the old file to the new one, giving at least the illusion that the file was renamed. However, with the Tortoise client for GIT, I see no equivalent. I've read that GIT tries to be smart and guess about renaming files, but binaries will be different enough that GIT doesn't consider it a "rename". Is there a way to force it to recognize a rename (or a move)?
Thanks!
09-07-2021 12:16 PM - edited 09-07-2021 12:17 PM
So far, I've come up with:
This is clunky, and there are plenty of ways to make mistakes, so if you have a better way, I'd like to hear it.
09-07-2021 03:55 PM
I've been using a Subversion Server and the Tortoise SVN client for over a decade, and have not ever used GIT.
My LabVIEW Projects, of course, are mostly in binary format (i.e. VIs and TypeDefs). When I've changed a name of a VI, I've just "accepted" the idea that it registers as a "Delete"/"New" pair of actions (even when it's something as trivial as changing the Folder where the VI or Control is saved). So far, I haven't had to do too much "unwinding", and have just accepted this behavior -- are you saying, however, that there is a way to "link" a file in Subversion when you do such a "move"?
Bob Schor
09-07-2021 06:12 PM
In SVN (with the Tortoise client), you can "repair" the file. This will make your SVN history jump from the old file to the new one so you can trace the file beyond the rename. (It's not really a rename of course; SVN still thinks you deleted a file and added a new one, it just copies the history to the new file.)
GIT has no way (that I know of) to do this, except manually like I described above, or by using the "GIT rename" function.
So it seems that TSVN has a better way of handling a file that was renamed without using the SCC renaming tool.
09-07-2021 06:14 PM - edited 09-07-2021 06:16 PM
@billko wrote:
In SVN (with the Tortoise client), you can "repair" the file. This will make your SVN history jump from the old file to the new one so you can trace the file beyond the rename. (It's not really a rename of course; SVN still thinks you deleted a file and added a new one, it just copies the history to the new file.)
GIT has no way (that I know of) to do this, except manually like I described above, or by using the "GIT rename" function.
So it seems that TSVN has a better way of handling a file that was renamed without using the SCC renaming tool.
Oops, the easiest way I've found to do the repair is to open the "commit" dialog, highlight both the file that SVN thinks was deleted, and the one that SVN thinks was added, then right-click on one of them and choose "repair". (And then cancel the commit.)
09-07-2021 06:27 PM
To move a folder, the easiest way is to create the destination folder, move all the files under the folder to be moved to the new folder (use the file view in the LV project explorer to do this), then delete the old folder. That way you can do the "fake commit" thing like above, but select the deleted folder and the new folder and do the repair on them.