Question

I'm using phpFog and have been deploying via git push -f <repo> to overwrite existing contents on the server. Some of my deployments were from totally different repos, as I was experimenting with some things.

I've found a file from a previous push, which no longer exists in the currently pushed repo, is lingering on the server. I can delete that file (via a php script), but each new push to the server will re-create that file -- even when the newly pushed repo doesn't contain it.

Lesson learned is to not push w/ force, I supposed -- but why is that random file being recreated when pushing repos that don't contain it?!

Again here is what I'm seeing:

  • git push -f repo_1 (contains random.txt)
  • random.txt exists
  • I delete all files, random.txt is now gone
  • git push -f repo_2 (does not contain random.txt)
  • random.txt exists again (why?!)

EDIT: I'm assuming that forcing changes to the repo leaves older files still being tracked, even if the new repo never tracked them. I've modified my deploy method to now clone what is on phpFog, git remove everything, and add in my new files before pushing. https://github.com/swt83/phpfog-deploy

Was it helpful?

Solution

Some of my deployments were from totally different repos

If you have a working copy (one that isn't borked), could you simply remove the git source directory and CLONE/PULL your working copy?

When committing, git commit -am "Message here" has always found deleted files and such. Is this the command you use to commit?

You may also succeed by trying to remove the text file from git's list:

git rm --cached random.txt

Github shows you how to keep that file from being tracked.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top