Git Commandes

De Marmits Wiki

Log

  • Voir les commits
git log --oneline
  • Voir les infos du dernier commit
git log -1 HEAD

Tag

Création

git tag -a v2.4.2 -m "Le message du commit"
git push --tags 

Suppression

git tag -d v2.4.1
git push origin :refs/tags/v2.4.1

La première ligne de commande retire le tag dépôt local. La deuxième retire le tag du repo distant

Voir

git show v2.4.1
git describe Les-bases-de-Git-Travailler-avec-des-dépôts-distantsags

Renommer

git tag v1.0.2 v1.0.2^{} -f -m "intégration du menu et reponsive"
git push -f origin --tags

Dépot

Récupère et fusionne automatiquement une branche distante dans votre branche locale actuelle

git pull

Paramètre votre nouveau projet avec branche locale pour qu’elle suive la branche master

git clone 

Récupère les modifications

git push [nom-distant] [nom-de-branche] 

Informations dépôt distant

git remote show 
git remote show [nom-distant]

Pour visualiser les serveurs distants

au moins voir l’origine origin nom par défaut que Git donne au serveur à partir duquel vous avez cloné

git remote 
git remote -v

Définir l'url du dépot distant

git remote set-url origin https://github.com/lecompte/leDepot 

ou pour ssh avec une key pub à ajouter

git remote add origin git@github.com:lecompte/leDepot.git

Appliquer la branche locale en fonction de la distante

git branch --set-upstream-to=origin/master master

Raliser le suivi d'une branche distante

git push --set-upstream origin master 

--- source: https://git-scm.com/book/fr/v2/Les-bases-de-Git-Travailler-avec-des-dépôts-distants

Branche

Liste des branches courantes

git branch

Liste des derniers commits sur chaque branche

git branch -v

Branches qui ont déjà été fusionnées dans votre branche courante

git branch --merged

Branches qui contiennent des travaux qui n’ont pas encore été fusionnés

git branch --no-merged

Créer une branche

git branch -b une_branche

Changer de branche

git checkout une_branche

Push sur une branche particulière

git push --set-upstream origin une_branche

=== Récupérer une branche qui n'existe pas en local

git checkout -b une_branche origin/une_branche

Stash

https://git-scm.com/docs/git-stash/fr

Fenêtre graphique

gitk