0

I have a private Github repo.

If I install Git locally, then whenever I make a change locally it will track that. My IDE will also track those changes through Git.

My IDE will also automatically upload changed files to my testing server, which will cause changes that will be tracked by Git there as well. If I do a git pull on the testing server, then it will probably generate a warning about untracked changes, even though those changes should make it exactly the same as the Github repo.

So does it even make sense to have Git in both places? Should I just have Git installed on my local dev machine? But then I can't guarantee all files on the server are up to date (e.g. if an FTP upload failed without me noticing it).

How does one solve this kind of issue?

Buttle Butkus
  • 9,206
  • 13
  • 79
  • 120
  • Is your repository on GitHub, or is it on some server? Your question is not entirely clear to me. – Tim Biegeleisen Nov 17 '15 at 02:30
  • @TimBiegeleisen It's on GitHub. I just created the GitHub repo from the files on my testing server. I was just in the process creating the git repo on my local development machine when the problem occurred to me. – Buttle Butkus Nov 17 '15 at 02:53
  • In Git's design model, every branch ultimately "lives" in the remote repository, which is usually shared by all the machines which are doing development. In your case, the local server should either behave like any other development machine, or it should be the repository itself. – Tim Biegeleisen Nov 17 '15 at 03:02
  • _Either_ have your IDE push the changes to test and don't use git _or_ make your test server monitor git for changes and automatically pull them down and build (well, could be a manual step invoked by your IDE). I prefer the automated checkout as it allows multiple builds to be queued and managed, which is crucial with multiple users and handy for anyone. It also allows you to ask your test server to build an older version without having to check it out locally and push it up with your IDE. – Basic Nov 17 '15 at 03:10
  • @TimBiegeleisen making my dev machine the repository might not work well, since I'm behind a firewall. I think it would be cumbersome to get the testing server to pull from me. On the other hand, setting up the testing server as the repository would be possible, but I'm wary of using a non-bare repository, mainly because I'm new to git and I've heard that it's "bad". – Buttle Butkus Nov 17 '15 at 03:20
  • @Basic I'm the only one working on this project so far, so the testing server is private to me for now. I like that I can save files in my IDE and see the changes live instantly without making a commit. E.g. I could try five variations of a mysql query and then only commit the fastest one. Can I do all "work" on my local git, pushing to Github, and then occasionally (e.g. at the end of the day) pull from Github to the testing server to ensure synchrony? I understand that that would be a problem if I start working with other devs, though. They would either need their own testing instances or... – Buttle Butkus Nov 17 '15 at 03:28
  • @Basic I'm thinking I might use your suggestion as a starting point. My IDE will update the testing server by FTP instantly. And then I can run `git fetch;git reset --hard origin/master` daily on the testing server to ensure fidelity. So the testing server will never do pushes, only pulls. http://stackoverflow.com/a/4787356/631764 – Buttle Butkus Nov 17 '15 at 03:58

0 Answers0