« Utilisation Git » : différence entre les versions

De Wiki Arthion
mAucun résumé des modifications
 
Ligne 64 : Ligne 64 :
git checkout -b nombranche origin/nombranche
git checkout -b nombranche origin/nombranche
</poem>
</poem>
=== Github like ===
http://www.apertoire.net/gogs-an-alternative-to-gitlab/

Version actuelle datée du 16 mars 2015 à 17:56

Installation

Config générale
git config --global user.name "Your Name"
git config --global user.email youremail@example.com

Alias pour se simplifier la vie
git config --global alias.co checkout

Associer son éditeur préféré
git config --global core.editor "gedit -w" (pas certain du fonctionnement de la commande)

Utilisation

Création du dépot : Dans le dossier racine du projet
git init

ajout de tous les fichiers du dossier :
git add .

Commit
git commit -m "commentaire du commit"

Historique
git log

Revenir au dernier commit et annuler les derniers changements de la branche en cours
git checkout -f

Derniers changements depuis le dernier commis
git status

Créer une branch
git checkout -b nomdelabranche

Etat des branches
git branch

Renommer ou déplacer un fichier avec git
git mv source cible

Fusionner deux branches :
se placer dans la branche souhaitée :
git checkout master

initier le merge:
git merge nomdelabrancheamerger

Envoyer les modifications sur le serveur:
git push

Récuperer les changements sur le repo d'origine
git fetch
ou
git fetch nomrepoorigine

http://www.opensourcery.co.za/2008/05/03/converting-a-mercurial-repo-to-git/

envoyer une branch sur un repo distant :
git push nombranche

recevoir branche repo distant
git pull
git checkout -b nombranche origin/nombranche

Github like

http://www.apertoire.net/gogs-an-alternative-to-gitlab/