1

I'm working on a project where I'm running a server on my local machine, developing the code on my local machine, and then committing my changes to a repo on Github.com via the Github Desktop app. As I develop, I'm at times reorganizing things - renaming directories, changing filenames, deleting files, etc.

Recently I noticed that when I make these kinds of changes, the old files and directories persist in the repo on Github.com, which makes for a fair amount of messiness.

I've looked for options in the desktop app and on Github.com to change this behavior - ie, make it so that locally deleted files and directories are deleted in the online repo as well, but can find nothing. I don't want to manually delete obsolete content on Github.com, or delete the repo contents entirely and start over if I don't have to.

Insight would be greatly appreciated.

Thanks.

Emma Scott Lavin
  • 185
  • 1
  • 14
  • Are u asking how to rename files in git? – CodeWizard Nov 10 '18 at 00:18
  • Not exactly. I guess to clarify that, I've been assuming that if I rename a file or directory, that the Github Desktop app sees that as a change - at the very least as a "this file was removed and that one was added" scenario, so "let's remove this file and add that file to the repo on remote commit." I'm NOT asking how to rename files manually at the moment as I'm hoping there's an answer here that implicitly makes it unnecessary to do so. – Emma Scott Lavin Nov 10 '18 at 01:03

1 Answers1

0

I've been assuming that if I rename a file or directory, that the Github Desktop app sees that as a change - at the very least as a "this file was removed and that one was added" scenario, so "let's remove this file and add that file to the repo on remote commit."

No: it won't touch the remote side.
Not until you are pushing your local commits to the remote, in which case the deletion recorded locally will be reported remotely.
But before that git push, nothing changes on the remote repo.

VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
  • Ok, thanks, but this doesn't really clarify anything for me. Because "the deletion recorded locally will be reported remotely" when I push my local commits to the remote. That means that when I push to the remote, locally deleted files should be reported there... right? But that's what's not happening. The deleted files are still there in the remote. And when I rename a directory and do a push, the renamed directory is there, along with the directory with the old name, which should be being deleted. – Emma Scott Lavin Nov 10 '18 at 01:39
  • @MarkScottLavin "But that's what's not happening. The deleted files are still there in the remote." That would be the case if you have added those files as new, without removing the old ones. Like with a wrong command of git add (https://stackoverflow.com/a/43199993/6309) – VonC Nov 11 '18 at 02:24