git and the command line

git and the command line


To open a terminal: Accessoires/Terminal.

Basic terminal commands

The first thing written in the terminal is the path, indicating where you are with the terminal, and the way to get there through the enclosing folders. The ~ sign represents your home directory, it is equivalent to the path “/home/user”.

In tutorials in general, we use $ to say after that $ type something. For instance $ cd means type cd. Here, we decided to remove the $ sign so we can just copy paste directly into the terminal.

Print Working Directory: tells you where you are on your computer.
MaKe Directory called relearn”.
Change Directory to folder
Go up one directory.

Go into a folder that is into another folder.
Go back to the home folder.

Show manual for a program (e.g. man ls).
Bash language.
Not for computers :) To write a message to another human reading the file.
MoVe/rename. Like:
Moves file1.jpg to file1_new.jpg.
Copies file1.jpg to file1_new.jpg.

And in general:
Open a file with a precise software, you need to be in the right folder, see up there.
See what files are part of the folder you are in.
Make a new empty file (if it already exists, it changes the modification date to now).

Various tips

Further reading



Note to selves: mistakes from the command line are almost always because of rushing too quickly and making spelling errors. Meditation is an answer, if not the only answer.


Git is a version management system. It is a way to keep track of work that has been done, and allows a group of people to work collaboratively. One is able to see who has changed what. People push their documented changes to a shared repository and collaborators can synchronise.

More about Git:

Setup Git

You need to tell Git with what name you want to “sign” your commits.
Open up a terminal window and type these commands line by line in the terminal:

To have colours on your terminal (makes it more legible):
We also need a way to authorize our server that you can write to it.
If you have the virtual machine that’s already done.
Otherwise, you need to generate an “ssh-key”.
You can check if you already have one:
If there are files like you already have a key!
If not, run :
It will ask you where to put it, you can just type Enter for the default location.
Then it asks you for a passphrase, meaning a password.
Then you display the key:
Copy it (Ctrl-Shift-C) and paste it on the pad, a bit below (ssh-keys).
Then, you’re ready to clone the Relearn repositories :

Maybe first, create a Relearn directory on your computer.
It is already created on the virtual machine.
So now you can clone the worksessions repositories:
And if you want the repository of the website:
And/or the one from the publication:
Exchanging files between the virtual machine and the host computer:

To clone a repository

Basic commands

shows the state of your files (have they been uploaded via Git or not?) When they are red, they are on your machine, but not in the Git repository.

# git add ...
will try to update your local files with the changes other people have put on the server.
git will try to ‘merge’ your changes with the changes made by others.
sometimes you need to resolve the conflict yourself

will update or create this file in the git index
it adds it in the files to be committed

takes the file out of the git index

will finally commit it on the repository
it opens nano, a text editor, to add a commit message describing your change
so you must add a description to the changes you are committing
try and type text at the top of the editor
the first line is the title/summary of the change
add a blank line
then expand if you want!

see the commands at the bottom: ^X to quit the editor, Y to say Yes: save
shows the history of the commits
it shows it in a shell, the sign : means there are several pages, and you can scroll with the arrows]
to close the screen type q

push back your changes to the server.
if others have also pushed in the meantime, you might need to pull first.

Order of git

View Git diffs in another programme

(get the id of the file you want to look at through git log) I used Meld
Merge tool candidates: 

To create a new git repository

You need a space on a server to host your project. You can host it on your own server, on Gitorious or on GitHub Gitorious is a free software Git hosting service, GitHub is a similar service which is closed-source but more popular. For those two online services, you need to create an account, and then there are simple explanations to create a new repository.
Then, you can copy/paste the address to clone your project on so that we have a shared place to share different projects. Put a one line description to invite people to look at your project.;a=blob_plain;f=git-scheme.svg

What we say

The latest 10 commits, excluding the merges. There is a delay of an hour…