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 trialMayur Pande
Courses Plus Student 11,711 Pointscommiting js to github
with node.js or js itself how do I commit to git?
2 Answers
Joe Beltramo
Courses Plus Student 22,191 PointsGood question. So git
itself is agnostic of any language or (most any) file type in it's repository, basically git
doesn't care. All git
related commands work with basically anything in the folder where the repository resides.
First you will want to create/initialize a git
repository, add any NodeJS or Vanilla JS code and then add the new items to the git repository. Once added you can commit the changes, most often done with a message detailing what was added. removed or changed.
Some good sources to learn about git would be:
Joe Beltramo
Courses Plus Student 22,191 PointsAh! Well, yes as you and Kevin have mentioned, git-bash is a good terminal for windows that I use as well when I must be on a windows box (which I avoid personally). I am not too sure, but I there might be a plugin for Sublime Text to handle Git Management. I use Atom for daily development which has a package for it that seemed to work well, but I eventually fell back into my two favorite uses, simply just using iTerm for most actions and Git Tower (for Mac, though they have a Beta for Windows at the moment). I primarily use Git Tower as a nice place to manage all of my repositories, all being C#, PHP, Javascript, C++, Swift, etc. It just provides a nice interface and a good place to view changes easier.
Also as Kevin mentioned, Github does have a desktop application for use as a Git Interface for managing repo's as well.
I would recommend git-bash as well for terminal based, or search for a Sublime package if you want it to be more simplified and tied to your editor.
When you do install Git on Windows, you should be also given an option on where you would like to be able to access Git, so if you did not want to use git-bash, you could use the Windows Command Prompt, which may allow you to also use Git in the NodeJS terminal, though I have never done that.
Hope that is a better answer!
Mayur Pande
Courses Plus Student 11,711 PointsThanks guys, I ended up downloading bash for windows.
But as you have mentioned doing work on windows not so great.
After all this I am just considering going back to my virtual machine (linux)! Its just my virtual machine lags sometimes. But I do like using vim, it has been weird today going back and forth between the console and sublime text. I found a few decent articles on setting up vim for javascript so going to give those a read and hopefully can sort it out!
Currently waiting for the new MBP to come out, so should be changing very soon!
Thanks again for the replies.
Joe Beltramo
Courses Plus Student 22,191 PointsJoe Beltramo
Courses Plus Student 22,191 PointsSome quick references:
Initializing git: (First, in a terminal/command prompt navigate to the folder you want to act as a repository)
git init
Check changes made by you in the repo:
git status
Add changes:
Commit changes:
Kevin Korte
28,149 PointsKevin Korte
28,149 PointsGood answer Joe! Git and github will allow you to check in anything, including images.
Mayur Pande
Courses Plus Student 11,711 PointsMayur Pande
Courses Plus Student 11,711 PointsHi Joe,
Thanks for the answer.
Unfortunately I don't think I explained my question properly.
I actually know how to use git, as I previously completed the git basics course you mentioned in your answer.
My question was more based on maybe where to commit it from.
For example I am coming from a php background, so I had a virtual machine running linux where I set up the console to initialize git repositories and I used vim as an editor so as soon as I wrote to a file I would commit it there and then from the console which was a relatively simple practice.
However since I have started programming javascript. I have simply been using sublime text on my windows environment and not committing anything to github!
Someone else mentioned to me to get git-bash for windows. I also read that I can get bash for windows now as I am used to the linux commands now I think this would be good. What are your thoughts on that?
Or with the npm terminal am I able to use git to initialize and commit files?
Kevin Korte
28,149 PointsKevin Korte
28,149 PointsI use git-bash on windows when I have to code on windows. It works fine, and will give you most of the familiarity you're looking for.
I think if you download the github desktop application, it brings in git-bash as well, and than I think it will give you a right-click - git bash to here option in the menu that is pretty slick.