diff --git a/Cheatsheet/git.html b/Cheatsheet/git.html index d59b3e9..798f883 100644 --- a/Cheatsheet/git.html +++ b/Cheatsheet/git.html @@ -2,7 +2,7 @@ title: Git cheatsheet description: published: true -date: 2022-01-03T09:39:50.529Z +date: 2022-01-03T09:52:00.464Z tags: cheatsheet, git editor: ckeditor dateCreated: 2022-01-03T09:39:50.529Z @@ -14,4 +14,64 @@ dateCreated: 2022-01-03T09:39:50.529Z git config --global user.name "Kevin Allioli"
Voir sa configuration
git config --list
-+
Initialiser un nouveau dépot:
+git init
+
+Cloner un dépot existant :
+git clone ssh://user@domain.tld/repository.git
+Ou
+git clone https://domain.tld/user/repository.git
+Créer un fichier « .gitignore » :
+touch .gitignore
+git add .gitignore
+git commit -m "Add gitignore"
+
+Créer un fichier « .gitignore » en utilisant un template « Windows »:
+curl -s https://www.gitignore.io/api/windows > .gitignore
+git add .gitignore
+git commit -m "Add Windows gitignore template"
+
+Créer un fichier « .gitignore » en utilisant un template « MacOS »:
+curl -s https://www.gitignore.io/api/osx > .gitignore
+git add .gitignore
+git commit -m "Add macOS gitignore template"
+Afficher le statut de votre répertoire de travail :
+git status
+
+Afficher les modifications sur les fichiers suivis :
+git diff
+
+Ajouter tous les changements au prochain commit :
+git add
+
+Ajouter tous les changements de toute l’arborescence :
+git add --all
+
+Commiter tous les changements locaux des fichiers suivis :
+git commit -a
+
+Commiter les modifications en attente :
+git commit -m 'Your message'
+
+Modifier le commit précédent :
+git commit --amend
+Ou
+git commit --am
+Afficher tous les commits :
+git log
+
+Afficher tous les commits (uniquement l’id et le message de commit) :
+git log --oneline
+
+Afficher l’historique d’un utilisateur uniquement :
+git log --author="username"
+
+Afficher l’historique des modifications pour un fichier uniquement :
+git log -p <file>
+
+Affiche les changements (en détails) dans le fichier :
+git blame <file>
+