Deprecated: Use of MediaWiki\Parser\ParserOutput::getText was deprecated in MediaWiki 1.42. [Called from SMW\MediaWiki\Hooks\OutputPageParserOutput::getParserOutput in /home/jltryoen/www/MediaWiki/extensions/SemanticMediaWiki/src/MediaWiki/Hooks/OutputPageParserOutput.php at line 161] in /home/jltryoen/www/MediaWiki/includes/debug/MWDebug.php on line 386
« Git » : différence entre les versions — La FAQ de JLT

« Git » : différence entre les versions

Aucun résumé des modifications
Ligne 3 : Ligne 3 :
== Configuration ==
== Configuration ==
=== Modifier l'éditeur de git ===
=== Modifier l'éditeur de git ===
<syntaxhighlight lang="bash">
{{syntaxhighlight| lang=bash |code=
git config core.editor "xemacs"
git config core.editor "xemacs"
</syntaxhighlight>
}}




=== Modifier l'outil de merge ===
=== Modifier l'outil de merge ===
<syntaxhighlight lang="bash">
{{syntaxhighlight| lang=bash |code=
git config merge.tool kdiff3
git config merge.tool kdiff3
</syntaxhighlight>
}}
<br>
<br>


==Soumettre des modifications ==
==Soumettre des modifications ==
===Ajout des modifications en local (staging)===
===Ajout des modifications en local (staging)===
<syntaxhighlight lang="bash">
{{syntaxhighlight| lang=bash |code=
git add .
git add .
</syntaxhighlight>
}}
<br>
<br>


===Suppression des modifications faites en local===
===Suppression des modifications faites en local===
<syntaxhighlight lang="bash">
{{syntaxhighlight| lang=bash |code=
git reset --hard HEAD
git reset --hard HEAD
</syntaxhighlight>
}}
<br>
<br>


===Suppression des fichiers non suivis par git en local===
===Suppression des fichiers non suivis par git en local===
<syntaxhighlight lang="bash">
{{syntaxhighlight| lang=bash |code=
git clean -f -d
git clean -f -d
</syntaxhighlight>
}}
<br>
<br>


===Soumission===
===Soumission===
<syntaxhighlight lang="bash">
{{syntaxhighlight| lang=bash |code=
# l'option -a fait aussi l'ajout des modifications dans l'index
# l'option -a fait aussi l'ajout des modifications dans l'index
# équivalent de git add . suivi de git commit
# équivalent de git add . suivi de git commit
git commit -a
git commit -a
</syntaxhighlight><br>
}}


===Modifier le commentaire du dernier commit===
===Modifier le commentaire du dernier commit===
<syntaxhighlight lang="bash">
{{syntaxhighlight| lang=bash |code=
git commit --amend "nouveau commentaire"
git commit --amend "nouveau commentaire"
</syntaxhighlight>
}}
<br>
<br>


=== Poser un label ===
=== Poser un label ===
<syntaxhighlight lang="bash">
{{syntaxhighlight| lang=bash |code=
git tag <nameoftag> <name of commit>
git tag <nameoftag> <name of commit>
</syntaxhighlight>
}}
<br>
<br>


=== Mettre à jour le label distant ===
=== Mettre à jour le label distant ===
<syntaxhighlight lang="bash">
{{syntaxhighlight| lang=bash |code=
git push <REMOTE> <name of tag>
git push <REMOTE> <name of tag>
</syntaxhighlight><br>
}}
''Il est possible de ne pousser qu'un commit à la fois''
''Il est possible de ne pousser qu'un commit à la fois''
<syntaxhighlight lang="bash">
{{syntaxhighlight| lang=bash |code=
git push <REMOTE> <sh1 of commit>:<branch>
git push <REMOTE> <sh1 of commit>:<branch>
</syntaxhighlight><br>
}}


=== Mettre à jour la branche distante ===
=== Mettre à jour la branche distante ===
<syntaxhighlight lang="bash">
{{syntaxhighlight| lang=bash |code=
git push <REMOTE> <name of branch>
git push <REMOTE> <name of branch>
</syntaxhighlight>
}}
<br />
<br />
<div class="blubox-jck">
<div class="blubox-jck">
Ligne 73 : Ligne 73 :


<div class="blubox-jck">
<div class="blubox-jck">
<syntaxhighlight lang="bash">
{{syntaxhighlight| lang=bash |code=
#en local
#en local
git branch -m <old-name> <new-name>
git branch -m <old-name> <new-name>
#en distant
#en distant
git push origin :<old-name> <new-name>
git push origin :<old-name> <new-name>
</syntaxhighlight>
}}
<br>
<br>
<br>
<br>
Ligne 86 : Ligne 86 :
Par exemple pour rebaser la branche locale
Par exemple pour rebaser la branche locale
<div class="blubox-jck">
<div class="blubox-jck">
<syntaxhighlight lang="bash">
{{syntaxhighlight| lang=bash |code=
git remote add upstream https://github.com/jmcameron//attachments.git
git remote add upstream https://github.com/jmcameron//attachments.git
git fetch upstream
git fetch upstream
git rebase upstream/attachmentsid
git rebase upstream/attachmentsid
</syntaxhighlight>
}}
<br>
<br>
<br>
<br>

Version du 2 août 2025 à 08:45

Configuration

Modifier l'éditeur de git

git config core.editor "xemacs"


Modifier l'outil de merge

git config merge.tool kdiff3


Soumettre des modifications

Ajout des modifications en local (staging)

git add .


Suppression des modifications faites en local

git reset --hard HEAD


Suppression des fichiers non suivis par git en local

git clean -f -d


Soumission

# l'option -a fait aussi l'ajout des modifications dans l'index
# équivalent de git add . suivi de git commit
git commit -a

Modifier le commentaire du dernier commit

git commit --amend "nouveau commentaire"


Poser un label

git tag <nameoftag> <name of commit>


Mettre à jour le label distant

git push <REMOTE> <name of tag>

Il est possible de ne pousser qu'un commit à la fois

git push <REMOTE> <sh1 of commit>:<branch>

Mettre à jour la branche distante

git push <REMOTE> <name of branch>


Renommer une branche

See
#en local
git branch -m <old-name> <new-name>
#en distant
git push origin :<old-name> <new-name>



Ajouter une source pour le repo distant

Par exemple pour rebaser la branche locale

git remote add upstream https://github.com/jmcameron//attachments.git
git fetch upstream
git rebase upstream/attachmentsid



Liens Externes