-2

I have two folders A and B under a parent folder X on Windows 10. The versions are:

  • Tortoise version#2.9.0.0

  • GitVersion:2.22.0.windows.1

While committing files using Tortoise GIT, I find that the Status is "Rename" for the versioned files. I may have copied the files (using Control-C and Control-V) in X to folder B. But I have also modified the files after copying. GIT is showing them as Renamed. Will my changes to the file contents be pushed after commit? I guess, I can try and find out. I wanted to ask the experts before making changes based on guess work.

Also some of the files in folder X are listed under unversioned category in the Commit screen. I don't understand why so. If I uncheck them, will it be a clean commit without further reengineering?

Thanks

2 Answers 2

1

In Tortoise Git just double click the file that shows the dubious renaming and check the differences in the view that pops up.

Since you moved files from one folder to another, the old file pointers are now expired, so make sure to add . and track those changes as well, this might already fix the renaming view issue. But I'd say just check the differences and if they are fine then you are too :)

Sign up to request clarification or add additional context in comments.

Comments

1

Git knows nothing of folders. It deals in files only, designated by their filenames, which include their paths. Simply moving a file from one folder to another is therefore just like leaving the file where it is and changing its name.

And what, as far as git is concerned, is that? They are two different files. What git sees, at heart, is a deletion of one file and creation of another file.

But at the same time, when git sees a deletion-and-creation, it tries to associate the new file with the old file and, if it can, it calls that a rename. The reason is that this makes the logs read better. If this is the "same" file, you'd like the history to continue through the renaming, rather than stopping at the deletion and starting as a different file with the creation.

Now, when you rename and modify, you make it harder for git to see that as a rename. It's not a good idea. But it sounds like git is still seeing this as a rename, which is good. In a worse scenario, rename and modify will cause git to lose the ability to connect the new file with the old file, and you'll see a deletion and a creation, separately.

So, to sum up, be happy this is seen as a renaming! You're lucky.

2 Comments

I don't understand what you mean by "Git knows nothing of folders. It deals in files only, designated by their filenames which include their paths" Specifically about paths. Can you please throw me an example? Is it an internal representation of a file? I have up voted you for your kind and detailed response. Your answer is appreciated.
I mean that a file is called /folderA/myFile.txt or folderB/myFile.txt. You think you moved a file from from folderA to folderB. Git thinks you renamed the file (or it might just think that /folderA/myFile.txt was deleted and folderB/myFile.txt was created, with no relationship between them).

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.