tech:notes_git
Différences
Ci-dessous, les différences entre deux révisions de la page.
| Les deux révisions précédentesRévision précédenteProchaine révision | Révision précédente | ||
| tech:notes_git [2026/06/07 19:12] – modification externe 127.0.0.1 | tech:notes_git [2026/07/29 14:22] (Version actuelle) – Jean-Baptiste | ||
|---|---|---|---|
| Ligne 137: | Ligne 137: | ||
| * https:// | * https:// | ||
| * Git-flow | * Git-flow | ||
| + | * https:// | ||
| Ligne 187: | Ligne 188: | ||
| git grep " | git grep " | ||
| ~~~ | ~~~ | ||
| + | |||
| + | |||
| + | |||
| + | ## Les branches | ||
| + | |||
| + | ### How do I clean outdated branches? | ||
| + | |||
| + | git fetch --prune is the best utility for cleaning outdated branches. It will connect to a shared remote repository remote and fetch all remote branch refs. It will then delete remote refs that are no longer in use on the remote repository. | ||
| + | |||
| + | ~~~bash | ||
| + | git fetch --prune | ||
| + | ~~~ | ||
| + | |||
| + | Source : https:// | ||
| + | |||
| + | |||
| + | ### Does git remote prune origin delete the local branch? | ||
| + | |||
| + | ~~~bash | ||
| + | git remote prune origin | ||
| + | ~~~ | ||
| + | |||
| + | No git remote prune origin will only delete the refs to remote branches that no longer exist. Git stores both local and remote refs. A repository will have local/ | ||
| + | |||
| + | Source : https:// | ||
| + | |||
| + | |||
| + | |||
| Ligne 415: | Ligne 444: | ||
| ~~~ | ~~~ | ||
| + | ~~~bash | ||
| + | # Checkout the stable branch and find just the latest tag | ||
| + | git checkout master | ||
| + | git describe --abbrev=0 --tags | ||
| + | git tag --sort | ||
| + | ~~~ | ||
| - | # # Checkout the stable branch and find just the latest tag | ||
| - | # git checkout master | ||
| - | # git describe --abbrev=0 --tags | ||
| - | # git tag --sort | ||
| - | + | undo git add | |
| - | undo `git add` | + | |
| ~~~bash | ~~~bash | ||
| git reset HEAD -- plop | git reset HEAD -- plop | ||
| Ligne 430: | Ligne 460: | ||
| git rm --cached plop | git rm --cached plop | ||
| - | #Suprimer le stagging | + | # Suprimer le stagging |
| git reset | git reset | ||
| + | |||
| + | # Ou | ||
| + | git restore --staged < | ||
| ~~~ | ~~~ | ||
| Ligne 622: | Ligne 655: | ||
| ~~~ | ~~~ | ||
| - | ## Pb | ||
| - | ### pb git reset --hard ne fonctionne pas | ||
| - | |||
| - | #### Solution | ||
| - | |||
| - | Utiliser `git checkout HEAD` | ||
| - | ~~~bash | ||
| - | #git reset --hard vars/ | ||
| - | git checkout HEAD vars/ | ||
| - | ~~~ | ||
| - | |||
| - | |||
| - | |||
| - | |||
| - | |||
| - | ### Err: unknown revision or path not in the working tree. | ||
| - | |||
| - | ~~~ | ||
| - | $ git reset preseed/ | ||
| - | fatal: ambiguous argument ' | ||
| - | Use ' | ||
| - | 'git < | ||
| - | ~~~ | ||
| - | |||
| - | |||
| - | #### Solution | ||
| - | |||
| - | ~~~bash | ||
| - | git checkout HEAD -- vars/ | ||
| - | ~~~ | ||
| - | |||
| - | |||
| - | ### Pb git diff et git difftool ne fonctionne pas | ||
| - | |||
| - | #### Solution | ||
| - | |||
| - | Utiliser l' | ||
| - | |||
| - | ~~~bash | ||
| - | git difftool --cached | ||
| - | ~~~ | ||
| - | |||
| - | Ou encore | ||
| - | ~~~bash | ||
| - | git difftool HEAD | ||
| - | ~~~ | ||
tech/notes_git.1780852327.txt.gz · Dernière modification : de 127.0.0.1
