rss
twitter
  • Showcase
  • Carrières
  • Support
  • GitLab
  • Espace client
  • Contact

Git: outils et commandes utiles

0

INDEX

Outils

Smart Git/HG: prend en charge Git et Mercurial, pratique notamment pour voir les changements mis en « stash ».

En mode console: tig

Très rapide pour naviguer dans les commits, avec une bonne coloration syntaxique c’est parfait. J’utilise oh-my-zsh et Solarized :

Capture d'écran du parcours d'un repository Git avec Tig

Capture d’écran du parcours d’un repository Git avec Tig

On peut aussi utiliser un pipe et lui envoyer le résultat d’une commande git, pour obtenir la coloration et naviguer dans les lignes, par exemple : git log | tig

Commandes

Voir ce qui va être poussé vers le repository distant

git diff origin/master

Voir l’état de la branche

git status

Créer une branche

 git clone <repository>
 git checkout <revision>
 git checkout -b <branch_name>
 git commit -m "Create branch <branch_name>"
 git push origin <branch_name>

Changer de branche

 git checkout <branch_name>

Roolback vers un commit particulier

 
git clone git@github.com:repo.git
git reset --hard 25616524640ffe74671fe5cd81ac7295338076f8
git reset --soft HEAD@{1}
git commit -a -m" Rollback commits"
# View what's going to be pushed"
git diff origin/master
git push

Reporter un commit d’une branche vers une autre (ici master vers branche)

La commande cherry-pick conserver l’auteur et la date d’origine.

 
git clone git@github.com:<repository>.git
git checkout 1_x
git cherry-pick <revision sha>
git add
git commit
git push

Pour reporter plusieurs commits

Le commit de gauche n’est pas inclu :

 git cherry-pick <oldest sha>..<latest sha>

Le commit de gauche est inclu :

 git cherry-pick <oldest sha>^..<latest sha>

Supprimer un tag

 
git pull
git tag -d 1_1
git push origin :refs/tags/1_1

Obtenir la liste des fichiers modifiés entre 2 commits

git diff-tree -r --no-commit-id --name-only --diff-filter=ACMRT c3dc087 268de04 | sed -e 's/.*/"&"/g'

Existe aussi en mode échappement des espaces :

git diff-tree -r --no-commit-id --name-only --diff-filter=ACMRT c3dc087 268de04 | sed -e 's/ /\\\ /g'

 


Voir aussi :
Importer un repository GIT dans un autre

DATE 27 Mai 2013
by : Guillaume
Author / Auteur

Social Share / Partager

    Leave a Reply / Répondre Annuler la réponse

    *
    *

    Search the blog

    Blog categories

    • Workflow (1)
    • Front-end : HTML, CSS (13)
    • Front-end : javascript, jQuery (33)
    • Back-end : PHP, CMS (42)
    • Back-end : SQL, MySQL (20)
    • Sysadmin : Linux, Apache, GIT (75)
    • Designers : tools, advice (2)
    • Desktop : OS X (37)
    • Desktop : Microsoft (12)
    • Uncategorized (8)

    ITALIC™ Resources

    • Paramètres de connexion au serveur mail
    • Graphistes : séduire un développeur web
    • Dév front : nos bonnes pratiques
    • Mailing : nos (bonnes ?) pratiques
    • Environnement de travail Mac

    Recent comments

    • Germain dans Inserer un motif dans une forme InDesign
    • Fannie J dans Inserer un motif dans une forme InDesign
    • Rapide benchmarks de clients Git pour Linux (et un peu Windows et Mac aussi) – Haha. dans Git avec SourceTree : ouvrir dans TextMate / ouvrir dans Sublime Text 2
    • Germain dans Ajouter des contacts non-Facebook à Spotify
    • cc dans Ajouter des contacts non-Facebook à Spotify

    Meanwhile, in the office…

    UNEP @ Paysalia

    01 Déc 2015

    Liebig

    22 Sep 2015

    Mercedes-Benz

    17 Sep 2015

    Office National du Tourisme Tunisien

    21 Août 2015

    Serious Game

    17 Juil 2015

    Engie

    22 Juin 2015

    UN Guiding Principles Reporting Framework

    21 Mar 2015

    Dites-le avec Nutella®

    21 Fév 2015

    HEC

    21 Déc 2014

    AREVA

    21 Déc 2014
    © 2008-2017 ITALIC™ • 8 bis rue Abel • 75012 PARIS • Tel +33 (0)1 48 44 46 35 • RCS PARIS 508 228 772 • Powered by WordPress & GoodLayers
    Nous utilisons des cookies pour vous garantir la meilleure expérience sur notre site web.
    Cookie settingsACCEPTER
    Manage consent

    Privacy Overview

    This website uses cookies to improve your experience while you navigate through the website. Out of these, the cookies that are categorized as necessary are stored on your browser as they are essential for the working of basic functionalities of the website. We also use third-party cookies that help us analyze and understand how you use this website. These cookies will be stored in your browser only with your consent. You also have the option to opt-out of these cookies. But opting out of some of these cookies may affect your browsing experience.
    Necessary
    Toujours activé
    Necessary cookies are absolutely essential for the website to function properly. This category only includes cookies that ensures basic functionalities and security features of the website. These cookies do not store any personal information.
    Non-necessary
    Any cookies that may not be particularly necessary for the website to function and is used specifically to collect user personal data via analytics, ads, other embedded contents are termed as non-necessary cookies. It is mandatory to procure user consent prior to running these cookies on your website.
    Enregistrer & appliquer