Git & Github pour les debutants Cheat Sheet

A Programming cheat sheet in français (French) by Weizu

Commandes pour Git et GitHub

18,781 views 3,976 downloads 3 Nov 2014 History
3.7 avg · 0 ratings

Pourquoi utiliser Git ?

Git est utilisé pour gérer les versions d'un programme et la collab­oration entre les dévelo­ppeurs.

Comment l'in­staller ?

Sur Windows :
Vous pouvez téléch­arger le Git Bash ou le Git Shell.

Sur Linux :
Direct­ement sur le terminal, utilisez cette commande :
sudo apt-get install git

Sur Mac :
Téléch­argez la dernier version des binaries à cette adresse :
https:­//c­ode.go­ogl­e.c­om/­p/g­it-­osx­-in­sta­lle­r/d­own­loa­ds/list
Il existe aussi une applic­ation dédiée à Github pour ceux qui n'ut­ilisent pas les lignes de commande :
https:­//w­ind­ows.gi­thu­b.com/

Creer et Utiliser une clef SSH

1) Créer la clef ssh :
ssh-keygen -t rsa -C "­mai­l@d­oma­in.c­om­"
(email du compte)

2) Copier la clef :
pbcopy <~/.ss­h/i­d_r­sa.pub

4) Accès au compte GitHub :
ssh -T git@Gi­thu­b.com
(après ça, tapez Y puis Entrer pour ajouter la clef au hôte)

Vous pouvez maintenant faire un git clone :
git clone git@Gi­thu­b.com pseudo/ HYPERLINK <re­pos­ito­ry_­lin­k>

Premiere utilis­ation

Configurer Git

git config --global user.name "­Prenom Nom"

git config --global user.email "­mai­l@m­ons­ite.fr­"

Config­uration et acces à GitHub

1) Inscri­ption sur :
http:/­/gi­thu­b.c­om/­sig­nup­/free

2) Configurer son repository
Utilisez cette commande dans le dossier du projet :
git init

Commandes Git

git init
Initia­lis­ation d'un répertoire
git status
Affiche le statut
git add <fi­le>
Ajoute un fichier
git add *
Ajoute les nouveaux fichiers
git delete <fi­le>
Supprime un fichier
git commit -m "the messag­e"
Créer un commit avec un message
git log
Affiche les commits antérieurs à l'actif
git show <co­mmi­t_h­ash>
Affiche les infos d'un commit
git branch <br­anc­h>
Crée une branche
git branch -v
Affiche les branches courantes
git checkout <pa­ram­ete­rs>
Switch sur une branche ou un commit
git checkout -b <br­anc­h_n­ame>
Créer une nouvelle branche et switch dessus
git merge <br­anc­h>
Fusionne la branche citée et le branche active
git remote add <re­mot­e_n­ame> <re­pos­ito­ry_­lin­k>
git push -u <re­mot­e_n­ame> <br­anc­h_n­ame>
git pull <re­mot­e_n­ame> <br­anc­h_n­ame>
git clone <re­pos­ito­ry_­lin­k>
Clone un projet sur sa machine
git help <co­mma­nd>
Détails d'une commande
git help
Liste des commandes
git diff
Affiche les différ­ences entre différents commits ou branches
git stash
Créer une sauvegarde locale mise de côté (hors du projet)
git stash list
Liste toutes les sauveg­ardes locales existantes

Badges

Nice Cheat Sheet Good Cheat Sheet Downloaded from Unusual Locations × 5

Comments (2)

TME520 01:21 13 Apr 2015

Thanks for your work, it helped me a lot !

Reply
Weizu 17:43 11 Aug 2017

You're welcome ! ;)

Reply

Cheatography n. The art of mapping complex subjects into clear, instantly navigable reference guides.