Smartgit: Renaming only directory creates "removed/added" AND "renamed" files - Page 1
Forum section: electronics / general

author: eTobey
author_rank: Super Contributor
timestamp: November 01, 2024, 02:13:03 pm
content: After a rename of a folder, git only recognizes a portion of the files as renamed. Interestingly, there is nothing logical i could investigate on: Files in the same folder show as "added/removed" or "renamed", even if they have a very similar name! And of course i havent changed their content.I tried several times, to find some clues, but i didnt find any. I also have only renamed the directory, to rule out any other problem creating causes.I cant imagine, git beeing so unreliable, so i guess its smartgit fault? How can i check with git alone?

author: eTobey
author_rank: Super Contributor
timestamp: November 02, 2024, 09:39:29 am
content: Git can not find a moved/renamed file (at some circumstances), even if the content is identical:I have renamed 2 directorys which had files of the same filename, but different content in it. It looked, as it would work, but when the files were staged, it all got messed up.The workaround is to simply do every rename in its own commit. Not such a great tool as i have thoughtThe problem for me was, the comparing of two commits of the file would not work in smartgit when it was removed/added. But it still keept somehow track of it as the same file. Strange at the very least.( Yes, its only negative feedback )

author: Siwastaja
author_rank: Super Contributor
timestamp: November 02, 2024, 10:40:11 am
content: Did you rename with the commandgit mv? That's a very usual catch for the young players.

author: eTobey
author_rank: Super Contributor
timestamp: November 02, 2024, 11:30:58 am
content: No i havent.I have read a lot of times, that mv is just like remove and add together. So it wouldnt make a difference then?But also it showed the desired result before the files were staged, so it worked somehow. Why did that change after the files were staged?

author: voltsandjolts
author_rank: Unknown
timestamp: November 02, 2024, 12:21:19 pm
content: Perhaps try to recreate the problem in the simplest possible case. Then it's easier for others to try it out and help answer your question.

author: eTobey
author_rank: Super Contributor
timestamp: November 02, 2024, 01:43:30 pm
content: Quote from: voltsandjolts on November 02, 2024, 12:21:19 pmI would have done that, but i found a workaround. After my experience with the Siglent crew and the bugs/issues of that SDS800X HD, i rather not waste much more time anymore to try to contribute to the community, if the outcome seems to be near 0, and me getting scolded too.

author: Siwastaja
author_rank: Super Contributor
timestamp: November 03, 2024, 10:11:42 am
content: Quote from: eTobey on November 02, 2024, 11:30:58 amgit mv is not mv, that's the whole point. Start by googling git mv. It's such common catch for young players you will find as much guidance and tutorials as you would ever need.

author: SiliconWizard
author_rank: Super Contributor
timestamp: November 03, 2024, 09:10:11 pm
content: IME, if you always use 'git add .' before committing, it will track all additions/renames/deletes... so that's enough.Now, if you want more fine-grained tracking, rather than brutally track every change you made to your local repo, git mv is an option. (I think you also have git rm to remove one file from tracking.)I tend to prefer 'git add .' to have an exact mirror of my changes, and I haven't seen any issues with that so far.But I don't particularly like git (I for one prefer Mercurial), so I may be missing some ultra important factor that would make what I said above too risky or not doing exactly what I think it does, so take that with a pinch of salt.

author: radiolistener
author_rank: Super Contributor
timestamp: November 03, 2024, 09:40:34 pm
content: Quote from: eTobey on November 01, 2024, 02:13:03 pmIn order to properly rename or move file or folder, you need to executeCode:git mv <old_name> <new_name>before commit you can check if all changes are correct withCode:git statusRemember, git is command line tool, so don't believe GUI shells and extensions and check the status with command line before commit