<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="fr">
	<id>https://wikibr.binets.fr/index.php?action=history&amp;feed=atom&amp;title=M%C3%A9mo_Git</id>
	<title>Mémo Git - Historique des versions</title>
	<link rel="self" type="application/atom+xml" href="https://wikibr.binets.fr/index.php?action=history&amp;feed=atom&amp;title=M%C3%A9mo_Git"/>
	<link rel="alternate" type="text/html" href="https://wikibr.binets.fr/index.php?title=M%C3%A9mo_Git&amp;action=history"/>
	<updated>2026-05-11T18:09:23Z</updated>
	<subtitle>Historique des versions pour cette page sur le wiki</subtitle>
	<generator>MediaWiki 1.38.2</generator>
	<entry>
		<id>https://wikibr.binets.fr/index.php?title=M%C3%A9mo_Git&amp;diff=8879&amp;oldid=prev</id>
		<title>Chi.huynh : Chi.huynh a déplacé la page Memo vers Mémo Git</title>
		<link rel="alternate" type="text/html" href="https://wikibr.binets.fr/index.php?title=M%C3%A9mo_Git&amp;diff=8879&amp;oldid=prev"/>
		<updated>2022-08-14T18:51:55Z</updated>

		<summary type="html">&lt;p&gt;Chi.huynh a déplacé la page &lt;a href=&quot;/Memo&quot; class=&quot;mw-redirect&quot; title=&quot;Memo&quot;&gt;Memo&lt;/a&gt; vers &lt;a href=&quot;/M%C3%A9mo_Git&quot; title=&quot;Mémo Git&quot;&gt;Mémo Git&lt;/a&gt;&lt;/p&gt;
&lt;table style=&quot;background-color: #fff; color: #202122;&quot; data-mw=&quot;interface&quot;&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;fr&quot;&gt;
				&lt;td colspan=&quot;1&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;← Version précédente&lt;/td&gt;
				&lt;td colspan=&quot;1&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;Version du 14 août 2022 à 20:51&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-notice&quot; lang=&quot;fr&quot;&gt;&lt;div class=&quot;mw-diff-empty&quot;&gt;(Aucune différence)&lt;/div&gt;
&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;</summary>
		<author><name>Chi.huynh</name></author>
	</entry>
	<entry>
		<id>https://wikibr.binets.fr/index.php?title=M%C3%A9mo_Git&amp;diff=8878&amp;oldid=prev</id>
		<title>Chi.huynh : Création de la page Mémo Git</title>
		<link rel="alternate" type="text/html" href="https://wikibr.binets.fr/index.php?title=M%C3%A9mo_Git&amp;diff=8878&amp;oldid=prev"/>
		<updated>2022-08-14T18:51:28Z</updated>

		<summary type="html">&lt;p&gt;Création de la page Mémo Git&lt;/p&gt;
&lt;p&gt;&lt;b&gt;Nouvelle page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;== Commandes git utiles au quotidien ==&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;code&amp;gt;HEAD&amp;lt;/code&amp;gt; : dernier commit&lt;br /&gt;
* &amp;lt;code&amp;gt;HEAD^&amp;lt;/code&amp;gt; : avant-dernier&lt;br /&gt;
* &amp;lt;code&amp;gt;HEAD^^&amp;lt;/code&amp;gt; : avant-avant-dernier&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;git status&amp;lt;/code&amp;gt; : montre les modifs entre le state actuel et le dernier commit&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;git diff&amp;lt;/code&amp;gt; : montre les modifs entre le state actuel et le dernier commit&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;git diff path/to/file&amp;lt;/code&amp;gt; : idem mais seulement pour le fichier specifie&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;git log&amp;lt;/code&amp;gt; : historique des commits&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;git add . &amp;lt;/code&amp;gt; : ajoute tous les fichiers de . au 'index'&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;git commit&amp;lt;/code&amp;gt; : commit les fichiers du index et demande un message (pas recommandé car ouvre vim)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;git commit -m &amp;quot;blablabla&amp;quot;&amp;lt;/code&amp;gt; : commit les fichiers du index avec le message &amp;quot;blablabla&amp;quot; (recommande, plus simple)&lt;br /&gt;
&lt;br /&gt;
Soft reset = annuler le fait d'avoir commité&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;git reset HEAD^&amp;lt;/code&amp;gt; : l'avant-dernier commit devient le dernier commit&lt;br /&gt;
&lt;br /&gt;
Hard reset = revert back to a previous commit. Attention ça annihile tes modifs.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;git reset --hard HEAD &amp;lt;/code&amp;gt; # nuke toutes les modifs qui ont été faites depuis le dernier commit&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;git pull&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* fast forward (no interleaving between local commits and pulled commits), or&lt;br /&gt;
* merge without conflict, or&lt;br /&gt;
* merge conflict&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;git push&amp;lt;/code&amp;gt; : un push est irréversible.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;git branch&amp;lt;/code&amp;gt; : list local branchs&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;git checkout other_branch&amp;lt;/code&amp;gt; : aller sur une autre branche&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;git branch nouvelle_branche&amp;lt;/code&amp;gt; : crée une nouvelle branche (locale) (mais ne va pas dessus)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;git branch -d branche_a_supprimer&amp;lt;/code&amp;gt; : supprime une branche&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;git checkout -b nouvelle_branche&amp;lt;/code&amp;gt; = &amp;lt;code&amp;gt;git branch nouvelle_branche&amp;lt;/code&amp;gt; + &amp;lt;code&amp;gt;git checkout nouvelle_branche&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Tous les fichiers utilisés par git sont rassemblés dans le sous-dossier &amp;lt;code&amp;gt;.git/&amp;lt;/code&amp;gt;. Pour dé-git-ifier un dossier, simplement supprimer le &amp;lt;code&amp;gt;.git/&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;.gitignore&amp;lt;/code&amp;gt; : fichier où spécifier les fichiers que git n'a pas à suivre (e.g. fichiers de config de projet d'eclipse&amp;gt;))&lt;br /&gt;
&lt;br /&gt;
== Pour les curieux ==&lt;br /&gt;
&lt;br /&gt;
=== Autres version control systems ===&lt;br /&gt;
&lt;br /&gt;
* CVS : vieux&lt;br /&gt;
* [SVN] (Subversion) : assez utilisé&lt;br /&gt;
* Mercurial&lt;br /&gt;
* Bazaar&lt;br /&gt;
&lt;br /&gt;
=== Notions générales ===&lt;br /&gt;
&lt;br /&gt;
==== Notation des commits : ====&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;code&amp;gt;HEAD&amp;lt;/code&amp;gt; : dernier commit&lt;br /&gt;
* &amp;lt;code&amp;gt;HEAD^&amp;lt;/code&amp;gt; : avant-dernier&lt;br /&gt;
* &amp;lt;code&amp;gt;HEAD^^&amp;lt;/code&amp;gt; : avant-avant-dernier&lt;br /&gt;
* &amp;lt;code&amp;gt;HEAD~2&amp;lt;/code&amp;gt; : idem&lt;br /&gt;
* &amp;lt;code&amp;gt;d6d98923868578a7f38dea79833b56d0326fcba1&amp;lt;/code&amp;gt; : indique un numéro de commit précis&lt;br /&gt;
* &amp;lt;code&amp;gt;d6d9892&amp;lt;/code&amp;gt; : le même commit (autocomplete implicite)&lt;br /&gt;
* &amp;lt;code&amp;gt;tags&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
Note that merge commits may have more than one parent:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;git show HEAD^1 # show the first parent of HEAD (same as HEAD^)&amp;lt;/code&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;git show HEAD^2 # show the second parent of HEAD&amp;lt;/code&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Vocabulaire ====&lt;br /&gt;
&lt;br /&gt;
The '''object database''' is the rather elegant system used to store the history of your project-files, directories, and commits.&lt;br /&gt;
&lt;br /&gt;
The '''index file''' is a cache of the state of a directory tree, used to create commits, check out working directories, and hold the various trees involved in a merge.&lt;br /&gt;
&lt;br /&gt;
'''Blob''' stands for Binary Large Object. Each version of a file is represented by blob. A blob holds the file data but doesn’t contain any metadata about the file. It is a binary file, and in Git database, it is named as SHA1 hash of that file. In Git, files are not addressed by names. Everything is content-addressed.&lt;br /&gt;
&lt;br /&gt;
'''Tree''' is an object, which represents a directory. A tree is a binary file that stores references to blobs and trees which are also named as SHA1 hash of the tree object.&lt;br /&gt;
&lt;br /&gt;
'''Tag''' assigns a meaningful name with a specific version in the repository. A tag is a branch, which nobody intends to modify. Once a tag is created for a particular commit, even if you create a new commit, it will not be updated&lt;br /&gt;
&lt;br /&gt;
'''HEAD''' is a pointer, which always points to the latest commit in the branch. Whenever you make a commit, HEAD is updated with the latest commit. The heads of the branches are stored in .git/refs/heads/directory.&lt;br /&gt;
&lt;br /&gt;
=== Config ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;git config --global user.name &amp;quot;mon_pseudo&amp;quot;&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;git config --global user.email &amp;quot;moi@email.com&amp;quot;&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Le fichier modifié par ces commandes et qui garde trace de ces paramètres est &amp;lt;code&amp;gt;~/.gitconfig&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== LF (\n) vs CRLF (\r\n) ====&lt;br /&gt;
&lt;br /&gt;
GNU/Linux and Mac OS uses line-feed (LF), or new line as line ending character, while Windows uses line-feed and carriage-return (LFCR) combination to represent the line-ending character.&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;code&amp;gt;git config --global core.autocrlf true&amp;lt;/code&amp;gt; : configure the Git client to convert line endings to CRLF format while checking out, and convert them back to LF format during the commit operation. (Useful for Windows system)&lt;br /&gt;
* &amp;lt;code&amp;gt;git config --global core.autocrlf input&amp;lt;/code&amp;gt; : configure the Git client to convert line endings from CRLF to LF while performing the checkout operation. (Useful for GNU/Linux or Mac OS)&lt;br /&gt;
&lt;br /&gt;
==== Examiner sa config ====&lt;br /&gt;
&lt;br /&gt;
Examiner sa config globale : tout simplement aller voir &amp;lt;code&amp;gt;~/.gitconfig&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Examiner la config d'un repository : regarder dans le &amp;lt;code&amp;gt;.git/&amp;lt;/code&amp;gt;, ou bien utiliser la commande &amp;lt;code&amp;gt;git config git config --list git config --get remote.origin.url&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Création / import / export de repository ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;git init&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;git clone [http[s]|ssh|ftp[s]|git]://host.xz[:port]/path/to/repo.git/&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Pushing a new (local) repository to the server :&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
(user@local:~$) mkdir github_repo ; cd github_repo&lt;br /&gt;
vim README.txt [...]&lt;br /&gt;
vim blah.c [...]&lt;br /&gt;
git init&lt;br /&gt;
git add .&lt;br /&gt;
git commit -m &amp;quot;Initial commit&amp;quot;&lt;br /&gt;
git remote add origin https://github.com/kangralkar/testing_repo.git&lt;br /&gt;
# defines remote-repository shorthand &amp;quot;origin&amp;quot; to the value [the GitHub repository's URL]&lt;br /&gt;
git push --set-upstream origin master&lt;br /&gt;
# push local changes (on local branch master) to the remote repository &amp;quot;origin&amp;quot;. push operation will ask for GitHub user name and password. After successful authentication, the operation will succeed.&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== remote repository shorthand ====&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;alice$ git remote add bob /home/bob/myrepo&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Après avoir exécuté ça, on peut écrire &amp;quot;bob&amp;quot; à la place de &amp;quot;/home/bob/myrepo&amp;quot; partout&lt;br /&gt;
&lt;br /&gt;
=== Voir les modifs ===&lt;br /&gt;
&lt;br /&gt;
==== Voir les modifs locales ====&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;git status&amp;lt;/code&amp;gt; : montre les modifs entre le state actuel et le dernier commit&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;git diff&amp;lt;/code&amp;gt; : montre les modifs entre le state actuel et le dernier commit&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;git diff path/to/file&amp;lt;/code&amp;gt; : idem mais seulement pour le fichier spécifié&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;git log&amp;lt;/code&amp;gt;: historique des commits&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;git log -p&amp;lt;/code&amp;gt; : historique complet des modifs&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;git log --stat&amp;lt;/code&amp;gt; : historique résume des modifs&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;gitk&amp;lt;/code&amp;gt; : will show a nice graphical representation of the history.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;git show c82a22c39cbc32576f64f5c6b3f24b99ea8149c7&amp;lt;/code&amp;gt; : see the details about this commit&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;git show HEAD&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;git show experimental&amp;lt;/code&amp;gt; : see the tip of the &amp;quot;experimental&amp;quot; branch&lt;br /&gt;
&lt;br /&gt;
==== Voir les modifs sur le serveur =====&lt;br /&gt;
&lt;br /&gt;
Alice can peek at what Bob did without merging first, using the &amp;quot;fetch&amp;quot; command; this allows Alice to inspect what Bob did, using a special symbol &amp;quot;FETCH_HEAD&amp;quot;, in order to determine if he has anything worth pulling, like this:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;alice$ git fetch /home/bob/myrepo master&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;alice$ git log -p HEAD..FETCH_HEAD&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;alice$ gitk -p HEAD..FETCH_HEAD&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The range notation &amp;lt;code&amp;gt;HEAD..FETCH_HEAD&amp;lt;/code&amp;gt; means &amp;quot;show everything that is reachable from the &amp;lt;code&amp;gt;FETCH_HEAD&amp;lt;/code&amp;gt; but exclude anything that is reachable from HEAD&amp;quot;. Alice already knows everything that leads to her current state (&amp;lt;code&amp;gt;HEAD&amp;lt;/code&amp;gt;), and reviews what Bob has in his state (&amp;lt;code&amp;gt;FETCH_HEAD&amp;lt;/code&amp;gt;) that she has not seen with this command.&lt;br /&gt;
&lt;br /&gt;
Alice may want to view what both of them did since they forked. She can use three-dot form instead of the two-dot form:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;alice$ git log HEAD...FETCH_HEAD&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;alice$ gitk HEAD...FETCH_HEAD&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This means &amp;quot;show everything that is reachable from either one, but exclude anything that is reachable from both of them&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
===== using remote-repository shorthand =====&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;alice$ git fetch bob&amp;lt;/code&amp;gt; : Unlike the longhand form, when Alice fetches from Bob using a remote repository shorthand set up with git remote, what was fetched is stored in a remote-tracking branch, in this case bob/master&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;alice$ git log -p master..bob/master&amp;lt;/code&amp;gt; : shows a list of all the changes that Bob made since he branched from Alice’s master branch.&lt;br /&gt;
&lt;br /&gt;
=== Commits ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;git add path/to/file1 path/to/file2 ... : ajoute des fichiers au 'index' (~ version 'staging')&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;git add . &amp;lt;/code&amp;gt; : ajoute tous les fichiers de . au 'index'&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;git commit&amp;lt;/code&amp;gt; : commit les fichiers du index et demande un message&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;git commit -m &amp;quot;blablabla&amp;quot;&amp;lt;/code&amp;gt; : commit les fichiers du index avec le message &amp;quot;blablabla&amp;quot;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;git commit -a&amp;lt;/code&amp;gt; : = &amp;lt;code&amp;gt;git add . &amp;lt;/code&amp;gt; + &amp;lt;code&amp;gt;git commit&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;git commit --amend&amp;lt;/code&amp;gt; : modifie le dernier message de commit&lt;br /&gt;
&lt;br /&gt;
==== Undo a commit ====&lt;br /&gt;
&lt;br /&gt;
Soft reset = annuler le fait d'avoir commité&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;git reset HEAD^ # l'avant-dernier commit devient le dernier commit&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Hard reset = revert back to a previous commit. Attention ça annihile des modifs.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;git reset --hard HEAD # nuke toutes les modifs qui ont été faites depuis le dernier commit&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;git checkout path/to/file&amp;lt;/code&amp;gt; : restaurer un fichier tel qu’il était au dernier commit&lt;br /&gt;
&lt;br /&gt;
Si on a déjà push au serveur, la seule option est de créer et de push un commit qui fait les modifs inverses (revert commit).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;git revert 6261cc2&amp;lt;/code&amp;gt; : crée un commit &amp;quot;inverse&amp;quot; du commit spécifié, i.e. qui revert les modifs (-- et le commit)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;git revert 6261cc2 --no-commit&amp;lt;/code&amp;gt; : pareil, mais ne commit pas ces modifs inverses&lt;br /&gt;
&lt;br /&gt;
==== Push and pull to server ====&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;git pull&amp;lt;/code&amp;gt; (= &amp;lt;code&amp;gt;git fetch&amp;lt;/code&amp;gt; + &amp;lt;code&amp;gt;git merge&amp;lt;/code&amp;gt;)&lt;br /&gt;
&lt;br /&gt;
* fast forward (no interleaving between local commits and pulled commits), or&lt;br /&gt;
* merge without conflict, or&lt;br /&gt;
* merge conflict&lt;br /&gt;
&amp;lt;code&amp;gt;git push&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Le changement vers le serveur doit être de type fast-forward car le serveur ne peut régler les conflits à votre place s’il y en a. Personne ne doit avoir fait un push avant vous depuis votre dernier pull. Le mieux est de s’assurer que vous êtes à jour en faisant un pull avant de faire un push. Si le push échoue, vous serez de toute façon invités à faire un pull. Un push est irréversible.&lt;br /&gt;
&lt;br /&gt;
=== Branches ===&lt;br /&gt;
&lt;br /&gt;
==== gestion locale ====&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;git branch&amp;lt;/code&amp;gt; : see local branches&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;git branch nouvelle_branche&amp;lt;/code&amp;gt; : crée une nouvelle branche (locale) (mais ne va pas dessus)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;git checkout other_branch&amp;lt;/code&amp;gt; : aller sur une autre branche&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;git branch -d branche_a_supprimer&amp;lt;/code&amp;gt; : supprime une branche&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;git checkout -b nouvelle_branche&amp;lt;/code&amp;gt; = &amp;lt;code&amp;gt;git branch nouvelle_branche&amp;lt;/code&amp;gt; + &amp;lt;code&amp;gt;git checkout nouvelle_branche&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;git merge branche_a_merger&amp;lt;/code&amp;gt; : merge branche_a_merger vers (dans) la branche courante&lt;br /&gt;
&lt;br /&gt;
Avant de changer de branche, tous les fichiers doivent être commités ou stashés. git status ne devrait afficher aucun fichier en cours de modification.&lt;br /&gt;
&lt;br /&gt;
==== stash ====&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;git stash&amp;lt;/code&amp;gt; : stash toutes les modifs dans un stash (propre à chaque branche)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;git stash apply&amp;lt;/code&amp;gt; : unstash les modifs de la stash (de la branche courante)&lt;br /&gt;
&lt;br /&gt;
==== gestion des branches locales + branches sur le serveur ====&lt;br /&gt;
&lt;br /&gt;
origin/branche_machin : désigne une branche sur le serveur (origin)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;git branch -r&amp;lt;/code&amp;gt; : lister toutes les branches que le serveur connait&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;git push --set-upstream origin branche_locale&amp;lt;/code&amp;gt; : copier une branche créée en local sur le serveur&lt;br /&gt;
&lt;br /&gt;
supprimer une branche sur le serveur : cf Google&lt;br /&gt;
&lt;br /&gt;
=== Tags ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;git tag NOMTAG IDCOMMIT&amp;lt;/code&amp;gt; : tagger une version, i.e. donner un alias à un commit précis pour le référencer sous ce nom.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;git push --tags&amp;lt;/code&amp;gt; : un tag n’est pas envoyé au serveur lors d’un push, il faut préciser l’option --tags pour que ce soit le cas.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;git tag -d NOMTAG&amp;lt;/code&amp;gt; : supprime un tag déjà créé&lt;br /&gt;
&lt;br /&gt;
=== Divers ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;git grep &amp;quot;TODO&amp;quot;&amp;lt;/code&amp;gt; (avec expressions régulières). avec -n : numéros de lignes. search any of the files it manages in your current directory&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;git grep &amp;quot;TODO&amp;quot; c82a22c39cbc32576f64f5c6b3f24b99ea8149c7&amp;lt;/code&amp;gt; : search for strings in a specified version of your project .gitignore&lt;br /&gt;
&lt;br /&gt;
=== Références ===&lt;br /&gt;
&lt;br /&gt;
https://git-scm.com/docs/gittutorial (replicates man gittutorial) https://git-scm.com/docs/giteveryday (replicates man giteveryday) https://www.tutorialspoint.com/git/ https://openclassrooms.com/fr/courses/1233741-gerez-vos-codes-source-avec-git https://git-scm.com/book/en/v1/Getting-Started&lt;/div&gt;</summary>
		<author><name>Chi.huynh</name></author>
	</entry>
</feed>