1

To be specific with the question i will list my scenario below,

  1. I have local git version installed in my windows machine, this is where i do the development (in developer branch).

  2. Then i upload it to the developer subdomain server for testing, once the testing is done i commit the local git to bitbucket based remote repository (developer branch in there).

  3. In my local and bitbucket both have master which i merge when i come to a specific point.

this all looks good and working fine for me, but my problem comes when i wanted move the modified files to the live server (real live website), what is the best way to do this ? which out uploading one by one checking the changed files...

i have git installed in my live server too, but i need to know,

  1. how can do a pull to my live git from the bitbucket ?
  2. If i do a pull will it overwrite user files/folder such as user uploaded images (which is obliviously not tracked in git)
  3. If want to untrack files, ex user upload files/ i use rm -rf {filename} but in this case it deleted the files from the os, is there a way to untrack without deleting.
  4. or is it a good idea to track everything including user files in the git ?

i am very new to git so, please give me some advice on how to do a proper development,local and live versions in git.

thanks

mahen3d
  • 5,246
  • 12
  • 46
  • 94

1 Answers1

0
  1. You setup a bare repo to which you can push to. A post-receive hook can then switch back to your non-bare live repo, and git pull from your bare repo.
    All the details in "Git submodule on remote bare" (you can ignore the "submodule" part)
  2. No, it won't overwrite non-tracked files
  3. If those files are untracked in the first place, you don't need to do anything.
    If your repo contains any file you wish to temporarily ignore, you can git update-index --assume-unchanged them.
    See "git commit config on initial commit but never again?"
  4. No, if files are purely local to an environment, it shouldn't be necessary to include them to a git repo (which is cloned around a lot)
Community
  • 1
  • 1
VonC
  • 1,042,979
  • 435
  • 3,649
  • 4,283