Today I’m leaving the podcasts for awhile to start with the good stuff, hands-on!

Since I will do some coding later on, trying new tech, it feels like Git is a good place to start. I want to learn the basics and then I can put my learning projects on Git and learn more advanced Git as I go along.

From the podcast in hour 3 I got some links and I’m starting with http://try.github.com/ which have some demo lessons to start with.

In the first lessons I got to try out my first basic commands. Listing them below as future reference.

git init: Will initialize an empty Git repository
git status: Checks if there are any untracked or not commited files.
git add filename: Add a file to the repository so that Git starts to track it.
git commit -m “A message with information about the commit”: Commits all uncommited files.
git add ‘*.txt’: Will add all txt-files to the repository, including files in subfolders.
git log: Displays the log of all the commits that have been made.
git remote add origin https://github.com/try-git//try-git.git: This will add a remote repository at the GitHub server.
git push -u origin master: This will push the local branch named master to the GitHub server. -u tells Git to remember the parameters so next time we just just git push.
git pull origin master: Pulls the master branch from the remote server and checks if changes has been made.
git diff HEAD: Check what’s different from your last commit.
git diff –staged: See what changes you have staged. Staged files are files that have been added but not yet commited.
git reset myfile.txt: Unstage a file.
git checkout — myfile.txt: Will change back the files to how they where at the last commit for the file myfile.txt.
git branch clean_up: Creates a new branch named clean_up.
git branch: Lists all available branches.
git checkout clean_up: Swith to the clean_up branch.
git rm ‘*.txt’: Remove all txt-files.
git merge clean_up: After switching back to master this is run to merge all the changes just made to the clean_up branch.
git branch -d clean_up: Delete a branch.

For each of these lessons there are also a lot of advice, don’t forget to read those as well. You’ll see them in the bottom right corner.

These great lessons take about 15 minutes and was an awesome place to start. After you also have the opportunity to a lesson from codeschool.com for free.

Now I’m ready to go on and create my own repository.

In the prevously mentioned podcast I also got the link to a free book, Pro Git by Scott Chacon and chapter 1 of that book seems like good place to start. I’m reading it on the web but have also downloaded it to my iPad so I can read it whenever I feel like it.

There’s some background about version control and the history of Git but I quickly moved through it and jump straight into setting up my own repo.

There’s a recommendation to install Git from source but right now I’m only interested in getting it up and running asap so I’m using the Windows installer from http://msysgit.github.com/. The installation is very easy. There are some settings but I used the default and was done in about 2 minutes.

First there’s some configuration to be done. I started up Git Bash, the command shell, and followed the instructions in the book to set up my identity. For the editor and merge tool I’ll go ahead and use the default for now.

Chapter 1 done and chapter 2 starts with the basics. Since I already went through the try.github.com lessons and this chapter is basically the same it didn’t take a lot of time before my repo was in place and I had done my first commit. I did however need to look at a bash command reference to navigate to my project folder.

I do prefer a GUI but I’ll stick with the command shell until I’ve learned Git a little better.

Advertisements