Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

Development Tools

Joe Ainsworth
Joe Ainsworth
13,588 Points

Critique my proposed Git workflow

I'm new to Version Control and git. I have only ever done low-end web development in my spare time and have felt no need to bother with a VCS. I've always just saved files and refreshed my browser to preview changes. However, in my commitment to become more competent I am now trying to implement git in my workflow. Because I am also working with Sass simply editing a .scss file via my FTP client won't work either.

I am using digitalocean VPS for my development. I propose to install and configure git in my public_html directory. I can then clone this to my local machine to set-up a local development environment and then work on new features such as a redesign by creating branches before merging and pushing back to the VPS.

Do I have the correct idea of how to use git?

2 Answers

Gwenaël Magnenat
Gwenaël Magnenat
14,617 Points

Tell me if I get your workflow wrong but it sounds to me like you are trying to reproduce what you can do with an FTP access.

With the online repo, you have all the additional feature it provides like bug tracking, file modification history, wiki etc. Possible as well to collaborate with other people on your development. You don't go through the clone process every time.

When you are done on your local machine, you push your project on your online repository (Github, Bitbucket or other service of your choice). SSH on your VPS and just git pull or git fetch, then switch to the features you want to implement. Does it make sense?

And if you want to deploy your website on another server ? you can simply clone your online repo, run your database migration (if you have any) and you are done.

Joe Ainsworth
Joe Ainsworth
13,588 Points

Yes very helpful. I was trying to reproduce an FTP process. But I now see the additional benefits this brings. I am working on a small project but anticipate it becoming larger so I started to learn git just in case I needed anyone to help.

The workflow you have explained is what I will implement.

Thanks for such a helpful answer. I think I may have heard one of your mixes before if I am correct!

Gwenaël Magnenat
Gwenaël Magnenat
14,617 Points

It sounds ok to me but I usually start from the other side and use an online repository separated from the production environment.

  1. Work locally
  2. commit your work and push on the online repository
  3. Install git on your production server and clone your project from the online repository
Joe Ainsworth
Joe Ainsworth
13,588 Points

Then every time you update your online repository go through the clone process on the server? Whats the benefit to creating an online repo? Backup?