Créé le 21/09/2014
Dernière mise à jour le 22/04/2022
Paramétrage :
git config --global user.name "name" git config --global user.email "mail@mail.mail" git config --global core.editor "vim" // ou emacs ou... votre éditeur préféré. git config --global core.excludesfile ~/.gitignore // adapter le chemin vers l'emplacement où vous aurez mis le fichier .gitignore global. git config --global color.ui true git config --global core.autocrlf false git config --global core.safecrlf false git config --global core.ignorecase false git config --global diff.renames copies git config --global alias.st 'status' git config --global alias.co 'checkout' git config --global alias.up 'pull --rebase' git config --global alias.sl 'log --graph --pretty=oneline --abbrev-commit --decorate' git config --global alias.slp 'log --graph --pretty=format:"%h%x09%an%x09%ad%x09%s" --abbrev-commit --decorate' git config --global alias.lg "log --graph --date=relative --pretty=tformat:'%Cred%h%Creset -%C(auto)%d%Creset %s %Cgreen(%an %ad)%Creset'" git config --global alias.lga "log --graph --abbrev-commit --pretty=format:'%C(red)%h%Creset -%C(yellow)%d%Creset %s %C(green)(%cr) %C(bold blue)<%an>%Creset' --all"
Paramétrage optionnel :
git config --global core.filemode false // Si vous voulez ignorer les modifications de permissions de fichier. git config --global branch.autosetuprebase always // Pour appliquer par défaut l'option --rebase
Fichier .gitignore global:
# Patch/diff artifacts. *.patch *.diff *.orig *.rej interdiff*.txt # emacs artifacts. *~ \#*\# # VI swap file. *.swp # Hidden files. .DS* .project # Windows links. *.lnk # Temporary files. tmp* # Exclude IDE's project directory. nbproject .idea # Package management systems. bower_components node_modules vendor yarn-error.log
Commandes :
git init git remote add nom_remote URL git clone URL git add . git add file git add -p git rm file git checkout . git checkout file git diff git diff file git commit git commit -m "message" git commit --amend git pull --rebase git push -u nom_remote branche git push -u nom_remote branche_locale:branche_sur_remote git log git checkout numero_commit git checkout nom_branche git checkout -b nom_nouvelle_branche git checkout -b nom_nouvelle_branche --track nom_branche_à_tracker git stash git stash pop git cherry-pick numero_commit git rebase -i HEAD~nombre_commits git tag -a nom_tag -m 'message de tag' git apply -v filename.patch git format-patch origin/[branchname] --stdout > [project_name]-[short-description]-[issue-number]-[comment-number].patch git remote prune nom_remote git add my_file && git commit --amend --no-edit && git push --force-with-lease
Ressources supplémentaires :
- https://www.drupal.org/node/1542048
- http://justinhileman.info/article/git-pretty/
- http://www.git-attitude.fr/2014/09/15/30-options-git-qui-gagnent-a-etre-connues/
- http://pcottle.github.io/learnGitBranching/
- http://mislav.uniqpath.com/2013/02/merge-vs-rebase/
- http://fle.github.io/git-tip-keep-your-branch-clean-with-fixup-and-autosquash.html
- http://rogerdudler.github.io/git-guide/
- http://rkueny.fr/developpement-web/garder-votre-gitignore-propre
- http://zeroturnaround.com/rebellabs/git-commands-and-best-practices-cheat-sheet/
- http://blog.fclement.info/git-merge-et-git-rebase-les-eternels-incompris
- https://delicious-insights.com/fr/articles/apprendre-git
- https://delicious-insights.com/fr/articles/bien-utiliser-git-merge-et-rebase/
Commentaires
Correctif
Il me semble que dans les versions récentes de git la commande "git config --global core.fileMode false" se fait sans "M" majuscule soit "git config --global core.filemode false"
Corrigé
Merci de ta remarque, c'est corrigé.
Il est vrai que les résultats de recherche sont parfois trompeurs par exemple ici : http://stackoverflow.com/questions/1580596/how-do-i-make-git-ignore-fil…, c'est avec un "M" qui arrive dans les premiers résultats.
Précision : solution locale pour un désordre global.
Dans les cas où votre config globale vous trahisse, c'est qu'elle est surchargée par une sournoise config locale... Pour régler cela, dans votre dépôt local:git config -e
et passer le paramètre filemode à false
Ajouter un commentaire