View on GitHub

git_for_humans

Git for humans

Git as is

Let’s move to the shell terminal/console/command line, if you are on Windows open GitBash.

Is Git there?

git

Exercise 1

Introduce yourself

When we use Git for the first time, we need to configure a few things.

Exercise 2

Use your name or nickname and the email associated with your GitHub account, for consistency.

$ git config --global user.name "Sam Claes"
$ git config --global user.email "sclaes@email.com"

We can add more options, but these are the two basic ones. You only need to do this the first time that you use Git. You can then check your options with:

git config --list

New Project

Create a folder on your preferred location.

$ mkdir firstGit
$ cd firstGit

Exercise 3

Once inside the folder, initiate a repository where Git can store versions of your files

git init

You need this every time you add a new project folder. Repositories should have a top level track of changes.

Thing 1. Let’s you tell the story of your project

git status

Exercise 4

We can create one file, using Atom editor. A good file to start with is a README.md file. (Learn more about the README.md tips)[https://www.makeareadme.com/] and (template)[https://readme.so/].

atom README.md

Check the story of your Project

git status

Track of changes time-stamp

git add
git status

Exercise 5

Add some the changes following the message instructions

git commit -m "adding a README.md"

Check the story of your Project

git status

Exercise 6

Check the story of your Project

git status

Exercise 7

What is our new status?

git commit -a 

Recap

repeat three times!

Break 10 min

Git history

We can ask Git to show us the project’s history using git log

Exercise 1

Exercise 2

Exercise 3

History summary

Now that we have a larger story on our project a good summary is

git log --oneline

Thing 2. Git Let’s you travel in time

git checkout [hash] filename
git status

Exercise 4

Note: Make sure to always indicate the name of the file to checkout, or you might find yourself into a detached HEAD state. After checking your files you can recover by typing git checkout master

Ignoring things

Exercise 5

There are some things like visual images that result from running your code and you should not need to save them, because you can generate them again.

Next: Game