Git Beginner Tutorial

This was originally a comment on reddit, but I figure it’d help other folks out, so I’m going to put it up here too.

So git, is a great tool for backing up your code projects, allowing you to easily save and manage different versions of your project among your friends and coworkers. But despite all the friendly packaging, on github, it was really intimidating. I didn’t know what a branch was, let alone a fetch, merge or anything even more complex like trunks and  bisecting. Eventually though, I got the basics sorted out. It was enough to send (push) a few of my repositories over to github. This was my basic experience:

A few weeks ago, I was lost and confused because all the docs were acting like I understood anything about anything. Then I played with Git GUI and saw all the functions laid out but I still didn’t understand what everything did, so I played around with it.

Then I used the git tutorial on github. Then I went and used the WingIDE’s git tool a bit, and found I could ‘commit’ stuff to a repository. Didn’t know what that was.

Then finally, I found the TryGit tutorial. This hands down was the best tool for me to learn what the basics of git were; and allowed me to create my own repositories easily.

Here are the basic steps you need to go do in order to set up a new repository on github:

  • you want to create a repo on github, save the http link.
  • Then go into git bash, type git init in the folder you want to create a repo in. Repo is short for repository, which is where you’ll keep all the files.
  • Then you’ll want to git pull url_from_github to pull all the data on the repo (maybe 1 text file).
  • Then go and add files to be watched by git, by going git add filename or git add *
  • Then you want to ‘commit’ the changes to the repo, along with a message, so you can save the state of all the files in your  repo: commit -a -m "This is a commit message"
  • Then you want to ‘push’ it to github so everone else can use it. git push url
  • Then you put in the username and password and you’re set. You won’t be able to see what you’re typing, but trust me, you’re typing something.

Hopefully that’s enough to get you started. I’m not a git guru or anything, so don’t asked me about anything to crazy. But I’ll try my hardest to help you out. As usual, hit me up on Twitter, reddit, or in the comments if you need any help at all.

2 thoughts on “Git Beginner Tutorial”

Leave a Reply

Your email address will not be published.