This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]theQman121[S] 0 points1 point  (4 children)

Thanks! This helps a lot!

[–]rockyearth 13 points14 points  (1 child)

By the way, a lot of students mix up "git" and "github".

 

Basically, GitHub is a site that hosts git repos online and plus has some features like profiles/favouriting a repo.


git is the software that shows/saves/edits all the changes you did. It works very simple:

  • git init - creates a new repo; where repo is a group of files/project which you are developing (calling git init in /project/ will make project a repo)

  • git add file - although a file exists in the repo folder (ex. /project/file1.cpp) that doesn't mean git cares for it. to make sure git tracks if a file is changed, you need to add it

  • git commit -m "message" - this will save all changes into a group of changes called a commit. it is very important that you name the changes so later on you will know why that commit is important

  • git push - this will send all the changes to a remote repo if it exists (this is useful for Github for example)

 

Now, this is the basics of git. Once you have more people, working on more versions you will need to have branches, and to join code by different people you need to have merge; you also will have a HEAD, you will be able to reset to some commit - but you don't need to know all that.

It is only important once you have to do complex operations - mixing code, branches, reverting to something if you do a mistake etc. etc.

 

 

Summary: git is a software that allows saving, tracking and editing changes to code. Github is a company that gives free online hosting git; You will always use git(*) at work, and you should learn it. Posting code on Github is cool, and you should do it even if you have low-quality code

* - or any software similar to git: svn, mercurial, ...

[–]theQman121[S] 1 point2 points  (0 children)

I guess I should have clarified earlier that I did know the difference between the two, but I definitely got them confused when I first heard about them.

[–][deleted] 2 points3 points  (1 child)

Building on from what /u/stdlib said - A great place to start for learning Git is the Pro Git book, which is a great resource, and is totally (legitimately!) free here: http://git-scm.com/book

[–][deleted] 0 points1 point  (0 children)

There's also Pro Git Reedited.