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 trial

Development Tools GitHub Basics Working By Yourself Push Your Project to GitHub

ludopuig
seal-mask
.a{fill-rule:evenodd;}techdegree
ludopuig
Full Stack JavaScript Techdegree Student 6,436 Points

Why using git commands instead of githhub's web page?

Hi,

In the video you are using git commands to create a local repo, upload the files and link with the remote repo, also created in the console. My question is the following: Why using git commands instead of using githhub's web (upload files and clone repo features) to do all this staff? What is the benefit?

Thanks!

3 Answers

Grace Kelly
Grace Kelly
33,990 Points

The short answer is there is no difference - you're doing the same thing with either method :) However i would argue that it's better and much easier using the git commands for a couple of reasons.

First of all the changes you make will be made locally first when adding and committing the files, before pushing it to github and so both your local tree and the tree on github will be the same which will prevent any conflicts and IMO there would be less of a chance of you forgetting to add a file.

Secondly it's waaaay faster to add and commit your changes when all you have to do is write a couple of commands as opposed to clicking and dragging each individual file. This can be a pain in the neck if you have multiple files whereas with the commands you can add all your changed files with a simple git add ., then git commit -m "Commit Message and then push it to github. It's also handy to use git's other commands like git status and git diff to track your local changes before committing.

One thing i do as a habit is - i create the repo on github, with it's description and whether its public/private etc and then clone that locally - i just prefer doing it that way, so really it's whatever suits your needs :)

Hope that helps!!

Stuart Wright
Stuart Wright
41,118 Points

Using the command line is one of those things that slows you down while you're still learning the commands, but once those commands become habit for you, you will find it much faster than using your mouse to browse around Github and upload files etc.

Another benefit is that when working with your code on a server, you may only have access to the command line, in which case it is actually necessary to use these commands, rather than just a time-saver.

That said, you can always learn it later. If you'd rather focus on your code for now and worry about the command line later, I don't see a problem with that - it's your choice.