Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialJoe Ainsworth
13,588 PointsCritique 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
14,617 PointsTell 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.
Gwenaël Magnenat
14,617 PointsIt sounds ok to me but I usually start from the other side and use an online repository separated from the production environment.
- Work locally
- commit your work and push on the online repository
- Install git on your production server and clone your project from the online repository
Joe Ainsworth
13,588 PointsThen every time you update your online repository go through the clone process on the server? Whats the benefit to creating an online repo? Backup?
Joe Ainsworth
13,588 PointsJoe Ainsworth
13,588 PointsYes 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!