I’m quite unclear what github is used for, other than knowing its important to learn. But codepen seems nice to work in because you can see what happens as you are working. I tried uploading code to github but then was confused at what that does, other than copy the code somewhere. are you supposed to link it to a domain somewhere?
Codepen is good when you need to make quick prototype or show your code to someone for debugging etc. For larger projects it is a pain to work in.
Git is a version control system, you record the state of your code by doing “commits”. If you screw up somewhere in the future you can see the changes and rollback your code etc. (of course there are many more features, but this one is the biggest sell for beginners )
GitHub is just a storage for your code.
Github will save your backside! What it allows you to do is to save different versions of your code. Git is the software that does the version control, Github is just a place to store Git versions of your software (which are called repositories, or repos.)
Say you have an app that is going well, but you still need to do one or two things. Wouldn’t it be great if you could save different copies of your code as you worked, as it got progressively closer to being finished, without having to manually copy and paste all these different versions to files? Github will do that. All you have to do is commit and push your changes to Github (or another site like Bitbucket that does the same thing) and there it is, like a time capsule. If you ever need to roll back to an earlier version, Git will help with that. It only takes a minute to roll back.
Now let’s say your app is growing and you want to bring in another developer to help you. She’s going to work on a new feature, while you continue to hack away at the existing ones.
But wait… what if she does something that breaks part of your code base? It would be hard to track down the bug, because you didn’t even code it.
Git to the rescue! With Git, your coding partner would have created her own branch of your code base, which she could work on independently. Later, when you were ready you could review the branch, eliminate any problems, and then merge the branch back into your core project. Awesome! Later features can use this same method. This is why Git is so important to open-source and team projects.
Codecademy has a great tutorial on Git, that you can do in a couple of hours. After you’re done you’ll have a much better understanding of how Git works: https://www.codecademy.com/learn/learn-git
what if u roll back to some of yours previous commit
can u if u want to back forward to commit that was your
Yes (not sure if this is the best way) you can:
- make a new branch
- on your master branch goto old commit (and do whatever you want)
- if you ever need to come back to
currentCommit, continue on
If i’m not wrong, you can also create a new branch and specify a commit as it’s base, work on this branch and merge at a later time.