https://github.com/kevin-doolaeghe/git
Git Commands Reference
https://github.com/kevin-doolaeghe/git
documentation
Last synced: 5 months ago
JSON representation
Git Commands Reference
- Host: GitHub
- URL: https://github.com/kevin-doolaeghe/git
- Owner: kevin-doolaeghe
- Created: 2022-03-05T11:12:29.000Z (over 4 years ago)
- Default Branch: main
- Last Pushed: 2022-06-17T23:25:25.000Z (about 4 years ago)
- Last Synced: 2025-05-31T11:37:59.275Z (about 1 year ago)
- Topics: documentation
- Homepage:
- Size: 6.84 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Git | Commandes
## Auteur
### Kevin DOOLAEGHE
## Sources
* [Git - Reference](https://git-scm.com/docs)
* [Git Cheat Sheets](https://training.github.com/)
* [Clone HTTPs repositories - `gh auth login`](https://cli.github.com/manual/gh_auth_login)
* [Github on CLI (`gh` command)](https://github.com/cli/cli/blob/trunk/docs/install_linux.md)
## Commandes
### Commandes de base
→ Afficher l'aide :
* `git help [-a]`
* `git`
→ Définir le nom d'utilisateur et son email :
* `git config --global --list`
* `git config --global user.name "Nom"`
* `git config --global user.email "E-mail"`
* `git config --global --unset-all user.name`
* `git config --global --replace-all user.name "Nouveau nom"`
→ Afficher les logs :
* `git log `
* `-(n)` : Afficher les n derniers commits
* `--since`, `--after` : Afficher les commits après une date
* `--until`, `--before` : Afficher les commits avant une date
* `--author` : Afficher les commits d'un auteur
* `-S` : Afficher les commits contenant la chaîne de caractères
→ Afficher le statut du dépôt :
* `git status`
→ Afficher les modifications qui ne sont pas encore indexées :
* `git diff`
→ Initialiser un dépôt :
* `git init`
### Gestion des fichiers
→ Ajouter des fichiers au suivi de version :
* `git add `
* `git add *`
→ Effacer des fichiers indexés :
* `git rm `
→ Déplacer des fichiers :
* `git mv `
→ Ignorer des fichiers :
* Créer un fichier `.gitignore`
* Renseigner les fichiers ou la forme des fichiers
→ Faire un commit :
* `git commit -a -m "message"`
### Gestion des branches
→ Ajouter une branche :
* `git branch `
* `git checkout -b `
→ Supprimer une branche :
* `git branch -d `
→ Changer de branche :
* `git checkout `
→ Pousser la branche :
* `git push --set-upstream origin `
→ Fusionner deux branches :
* `git checkout `
* `git merge [-no-ff]`
### Fonctionnement en distant
→ Cloner un dépôt distant :
* `git clone `
* `git clone --branch `
* `git clone https://[utilisateur]:[mot de passe]@[projet]`
→ Afficher la liste des dépôts distants enregistrés :
* `git remote`
→ Ajouter un dépôt distant :
* `git remote add `
→ Renommer un dépôt distant :
* `git remote rename `
→ Récupérer les informations sans les ajouter à la branche courante :
* `git fetch `
→ Récupérer les information et les ajouter à la branche courante :
* `git pull origin `
→ Pousser son travail sur un dépôt distant :
* `git push origin `
* La branche par défaut est `master`
→ Inspecter un dépôt distant :
* `git remote show [n]`