Ceci est une ancienne révision du document !
Git
Créer dépôt nu ("bare")
S'il existe déjà un dépôt Git, le cloner :
git clone --bare my_project my_project.git
Sources : Getting Git on a Server et Git bare vs. non-bare repositories
Sinon, créer depuis les sources :
mv project project.git cd project.git git init --bare --shared git add . git commit -m 'initial commit'
Gestion des dépôts distants (remote)
Lister
$ git remote -v origin //Efiles.feel-it.mad/xanit/sources_dvpt/git/gdm/commerce/bonkdostor-gdm (fetch) origin //Efiles.feel-it.mad/xanit/sources_dvpt/git/gdm/commerce/bonkdostor-gdm (push)
Sources : Working with Remotes
Ajouter
git remote add origin "///Efiles.feel-it.mad\xanit\sources_dvpt\git\gdm\ecommerce\ExportJobGDMToSparkow.git"
Remplacer origin par le nom du dépôt
Changer URL
$ git remote set-url origin "///Efiles.feel-it.mad\xanit\sources_dvpt\git\gdm\ecommerce\flux-probance.git"
Remplacer origin par le nom du dépôt
Changer date d'un commit
git filter-branch -f --env-filter \ 'if [ $GIT_COMMIT = ee75eb2698bb3c2da694eb3599ad7a990999d1f3 ] then export GIT_AUTHOR_DATE="Sun Feb 09 22:00:00 2014 +0100" export GIT_AUTHOR_DATE="Sun Feb 09 22:00:00 2014 +0100" fi'
Source : http://stackoverflow.com/questions/454734/how-can-one-change-the-timestamp-of-an-old-commit-in-git
Annuler un commit
Supprimer définitivement le dernier commit non pushé :
git reset --hard HEAD~1
Supprimer le dernier commit non pushé tout en conservant les modifications dans la staging area :
git reset --soft HEAD~1
Revenir dans l’étant du commit précédent en appliquant un nouveau commit qui est exactement l’opposé du précédent : très pratique pour annuler un commit qui a déjà été pushé, et qu’on ne peut donc pas supprimer du dépôt central sans gêner les collaborateurs :
git revert HEAD~1
Source : http://gebeo.info/2014/05/13/git-annuler-le-dernier-commit/
Dépôt sur OVH
ssh login@ssh.cluster006.ovh.net #Sur le serveur OVH mkdir -p ~/sources/nom_projet.git cd ~/sources/nom_projet.git git init --bare
#En local cd ./nom_projet git remote add ovh ssh://login@ssh.cluster006.ovh.net/home/login/sources/nom_projet.git git push ovh master
Source : http://wiki.rezo-zero.com/index.php?title=Cr%C3%A9er_un_d%C3%A9p%C3%B4t_nu_sur_OVH&oldid=657
A lire aussi : https://blog.jtlebi.fr/2013/11/30/gerer-son-site-avec-git-sur-un-serveur-mutualise/
Corriger error: refs does not point to a valid object
git repack -a && rm ./objects/info/alternates
Cf. http://randyfay.com/content/git-clone-reference-considered-harmful
Supprimer un tag
git push --delete origin tagname git tag -d tagname
Source : http://stackoverflow.com/questions/5480258/how-to-delete-a-remote-tag