git-ftp
git-ftp copied to clipboard
Delete file from index SHOULD NOT delete file on FTP
I removed a file from the index git rm --cached file and it was deleted on FTP, while it shouldn't.
--cache
Use this option to unstage and remove paths only from the index. Working tree files, whether modified or not, will be left alone.
i disagree. git rm --cached removed a file from the index. the remote files on your ftp server are a copy of the index, not your local directory. so it's doing exactly what it should be.
Remote files aren't necessarily a copy of the index. There can be uploaded files by the user, or explicitly remotely changed files (config, htaccess) Therefore I would see the FTP as a kind of a remote working tree.
Consider this use-case: .htaccess was included by accident. But it should be ignored. How can we correct that?
Adding it to .gitignore doesn't help when it's already tracked. You have to remove it from the index to have it untracked, but IMHO it shouldn't be deleted on FTP.
Dunno if python-git can see the difference between a removed file and index-removed only file, that leaves working tree files alone.
Closed it by accident, can't see a way to reopen it.
perhaps an option could be added to the config file or some form of git-ftp only .gitignore file.
We should be diffing against HEAD, which is not the index, so this is pretty mysterious. I'll take a look.
I can't reproduce, so I'll need explicit instructions.
W.r.t. to not uploading certain files, sure, that's a reasonable feature request. Please open another issue?
I will look it to it later, and see if I can make a reproducible example.
Can easily reproduce. Create a repository with 2 files, add one to ignorelist, remove it from cache, it will be deleted on FTP.
By maybe that's default operation, because it's removed from the repository, and git rm --cache is only a local command to leave it in local working directory.
I don't know if the repository (HEAD, index) has any clue if a a git rm file or git rm --cache file command has been given.
If not there isn't much we can do, and my problem wasn't an issue but a lack of knowledge about git.
It's still difficult to parse what you're saying. Can you write down the precise commands you are using?
Sorry, a bit late.
1 create new dir html with 2 files index.php and .htaccess 2 cd .. git clone --bare html html.git 3 scp -r html.git server:/home/git-reps 4 mv html html_bu 5 git clone server:/home/git-reps/html.git 6 rm -rf html_bu 7 set ftp data in: server:/home/git-reps/html/ftpdata 8 git push, everything will be ftp'd to ftpserver
I need a different .htaccess locally then on the ftp server. Of course changing .htaccess will change .htacces on ftp-server. So I want to stop tracking .htaccess: I add it to .gitignore Changes to .htaccess will still be tracked cause it's still in the index. So i remove it from the index: git rm --cached .htaccess Now .htaccess is also removed from the ftp-server next push, while I think it shouldn't, at least i don't want it to happen. ;)
But I don't know if the index, or to be specific the post-update hook can make a difference between a git rm and a git rm --cache command after it's pushed.