Jump to content
Larry Ullman's Book Forums

Recommended Posts

Hi Larry

 

Would you be able to give a little guidance in the process of using Git to maintain a live server. I had git on my computer a while ago, but never really got round to using it. Although it seems fairly easy to use.

 

How or should you use it in general terms to maintain a live server?

 

So far,  I have made a private repo from my local version and I have made another private repo of my live code as they differ a few ways, mainly due to config for DB etc and for web hooks.

 

What would I need to do to be able to use GIT to update a live server? Do a git init command on my live sever and then clone + push + add files through the command line on my server?

 

I saw this answer and felt like I was on the right kind line http://stackoverflow.com/a/12517125/895169

Link to comment
Share on other sites

You can only push to where you've placed a repo, so unless you have control of that server and Git installed on it, you basically can't.

If you're in a shared hosting environment though, then you'll just have to use an FTP client or whatever to move the files.

 

Also, congrats on post #1,000!

Link to comment
Share on other sites

Ok, I see now, I wasn't sure. I'm seriously considering getting a cloud VPS and I saw someone was asking about installing on Git and since my Mac i've been thinking more and more about how to work between two devices. So I learned Git (Not all of it, but enough to get you on your way) last night. BTW BitBucket gives out free private repositories to teams of less than 5 devs. So as it's just me that's fine for me.

 

Oh yeah, I saw it was at 996 the other day. I'm not as active/helpful as I once was. But 1000 is nice. 

Link to comment
Share on other sites

BitBucket is pretty good from what I've heard. You should try it out.

 

With that said, I honestly am not always that gung-ho about these "new-age solutions".

For example, you can easily format a flash drive on Mac OS X to work on both Windows systems and Mac systems. With that alone, you can easily move files back and forth. Perhaps it's a bit more manual than you prefer, but really, how often do you have to move files between devices anyway?

 

And on a side note, I had to use Git a lot at my last job, and frankly, it caused the team more headaches than it was worth in my opinion.

I'm not saying Git is bad, but it's not the cure-all it's made out to be.

Link to comment
Share on other sites

I've also heard good things about BitBucket. And kudos to Jonathon for 1,000 posts! Thanks for all your help and feedback over the years. 

 

I'm going to disagree with HartleySan both about Git being a "new-age solution" and not being all that great. I am by no means a Git expert, although I use it regularly.

 

First, in terms of syncing over multiple devices, it's very easy and fast to do with Git. You never have to use a flash drive and do manual copying and plug the drive in and... That's just such a crude approach.

 

Second, and more importantly, Git doesn't just offer syncing over multiple devices. Git is first and foremost version control. If you make a mistake in some code that you don't discover until later and copy that script to another device, you're screwed. With version control you can go back to previous versions in a breeze. You can also make very atomic changes. 

 

I think even basic usage of Git is very easy, reliable, and fast. On an advanced level, it's superb. Again, I'm not a Git pro, but I work for an organization that has 100+ people using Git on a complicated code base. We're always looking for, or willing to consider, better tools, and I don't ever hear anyone talk about not using Git. 

 

Not a cure-all but pretty damn great and easy to use.

Link to comment
Share on other sites

Yeah, I'm enjoying BitBucket. I was very surprised how fast it was to upload my entire local version of website too. I wanted somewhere to store a back up just in case there was an EMP go off my house or other extreme circumstance that I'd lose my files. So having had a little play with it, and since done some changes with elastic search on my local server, I should add and commit those files to the repo? That's how it should?

 

My main concern is forgetting to add one file out of the dozens I may have changed. I suppose it is bad practice to just keep uploading the whole folder each time?

 

And thank you Larry for all your help more so!

Link to comment
Share on other sites

My main gripe with Git is that in my experience, people don't know how to properly use it, and thus cause all sorts of issues like doing a force push and overwriting all changes they hadn't themselves captured yet. (This happened several times at my last employer and caused us a ton of frustration and days of lost dev time. And it's so easy to do. If you simply force push something or even have your config set up to automatically force push without your knowledge, I guarantee this will happen.)

 

With that said, I agree with Larry that there isn't much better out there than Git for large dev groups, and certainly, the version control is the most important thing.

However, I still believe that in your case, as a single dev looking to maintain your codebase across Windows and Mac OS, a flash drive is sufficient and the easiest.

Just my opinion though.

Link to comment
Share on other sites

Even though I use Git on an almost daily basis, I'm still trying to get better at it in terms of best practices. I have learned that more, smaller, and atomic commits are best. Some good resources:

 

http://sethrobertson.github.io/GitBestPractices/

https://wiki.openstack.org/wiki/GitCommitMessages

http://www.lullabot.com/blog/article/git-best-practices-workflow-guidelines

Link to comment
Share on other sites

 Share

×
×
  • Create New...