Différences

Ci-dessous, les différences entre deux révisions de la page.

Lien vers cette vue comparative

Les deux révisions précédentes Révision précédente
Prochaine révision
Révision précédente
git [2017/07/24 15:58]
Yoh
git [2019/11/20 16:12] (Version actuelle)
Yoh
Ligne 3: Ligne 3:
 ==== Mes réglages ==== ==== Mes réglages ====
  
-=== Git log === +=== Git diff-so-fancy ​===
-Pour avoir un log plus détaillé que la simple commande ''​ git log '',​ créez un alias dans le fichier //​~/​.gitconfig//​ pour avoir un rendu avec un graphique. [[https://​stackoverflow.com/​questions/​1057564/​pretty-git-branch-graphs|source]]+
  
-<​code>​ +Pour avoir des diffs plus sympa installer ​[[https://​github.com/​so-fancy/diff-so-fancy|diff-so-fancy]].
-[alias] +
-lg = log --graph --abbrev-commit --decorate --date=relative --format=format:'​%C(bold blue)%h%C(reset) ​%C(bold green)(%ar)%C(reset) %C(white)%s%C(reset) %C(dim white)%an%C(reset)%C(auto)%d%C(reset)'​ +
-lgf = log --graph --abbrev-commit --decorate --name-status --date=relative --format=format:'​%C(bold blue)%h%C(reset) - %C(bold green)(%ar)%C(reset) %C(white)%s%C(reset) %C(dim white)- %an%C(reset)%C(auto)%d%C(reset)'​ +
-lga = log --graph --abbrev-commit --decorate --date=relative --format=format:'​%C(bold blue)%h%C(reset) - %C(bold green)(%ar)%C(reset) %C(white)%s%C(reset) %C(dim white)- %an%C(reset)%C(auto)%d%C(reset)'​ --all +
-</​code>​+
  
-Ensuite pour l'​afficher,​ il suffit d'​entrer ​la commande ''​ git lg… ''​+Ensuite ​lire la doc pour le régler ou copier les réglages plus bas dans la page (.gitconfig)
  
 === Git prompt === === Git prompt ===
Ligne 55: Ligne 49:
 git push --delete repo branch git push --delete repo branch
 </​code>​ </​code>​
- 
-=== Déplacer master et HEAD (pour effacer les commits au dessus qui sont déjà pushé)=== 
-<​code>​ 
-git rebase --onto XXX 
-</​code>​ 
-//XXX correspond au numéro de commit// 
  
 === Avoir une information sur la création d'une branche === === Avoir une information sur la création d'une branche ===
 <​code>​ <​code>​
 git reflog --date=local | grep [branch] git reflog --date=local | grep [branch]
-</​code>​ 
- 
-=== D'​autre alias === 
-<​code>​ 
-co = checkout 
-diffc = diff --color-words=. 
-save = !git add -A && git commit -m '​SAVEPOINT'​ 
-undo = "!f() { branch=\"​[$(git rev-parse --abbrev-ref HEAD)] : SAVEPOINT\"; ​ message=$(git log --format=format:'​%s'​ -1); if [ \"​$branch\"​ == \"​$message\"​ ]; then git reset HEAD~1 --mixed; else echo \"​SAVEPOINT non trouvé, annulation de la commande git undo\";​ fi; }; f" 
 </​code>​ </​code>​
  
Ligne 85: Ligne 65:
 <​code>​ <​code>​
 git merge -Xignore-all-space [branch] git merge -Xignore-all-space [branch]
 +</​code>​
 +
 +=== Faire le ménage dans les branches ===
 +Un alias pour supprimer en locale les branches mergées.
 +<​code>​
 +git_delete_branches_merged='​git branch --merged | egrep -v "​(^\*|master|dev)"​ | xargs git branch -d'
 +// ou
 +// git_delete_branches_merged='​git branch --merged origin/​integ | grep -v '​\''​integ$'​\''​ | xargs -r git branch -d'
 </​code>​ </​code>​
  
Ligne 91: Ligne 79:
 <​code>​ <​code>​
 [user] [user]
- name = Lionel JAMAL + name =  
- email = lionel.jamal.externe@crossquantum.com+ email = 
 [color] [color]
  # Enable colors in color-supporting terminals  # Enable colors in color-supporting terminals
- ui = auto+ ui = true
 [core] [core]
  # Don't paginate output by default  # Don't paginate output by default
- pager = cat+ pager = test -x \"​$(which diff-so-fancy)\"​ && diff-so-fancy | less --tabs=4 -RFX || less -RFX 
 + editor = vim
 [color "​branch"​] [color "​branch"​]
  # Blue on black is hard to read in git branch -vv: use cyan instead  # Blue on black is hard to read in git branch -vv: use cyan instead
  upstream = cyan  upstream = cyan
 [alias] [alias]
-lg = log --graph --abbrev-commit --decorate --date=relative --format=format:'​%C(bold blue)%h%C(reset) - %C(bold green)(%ar)%C(reset) %C(white)%s%C(reset) %C(dim white)- %an%C(reset)%C(auto)%d%C(reset)'​ + #lg = log --graph --abbrev-commit --decorate --date=relative --format=format:'​%C(bold blue)%h%C(reset) - %C(bold green)(%ar)%C(reset) %C(white)%s%C(reset) %C(dim white)- %an%C(reset)%C(auto)%d%C(reset)'​ 
-lgf = log --graph --abbrev-commit --decorate --name-status --date=relative --format=format:​'%C(bold blue)%h%C(reset) - %C(bold green)(%ar)%C(reset) %C(white)%s%C(reset) %C(dim white)%an%C(reset)%C(auto)%d%C(reset)'​ + lolc = log --graph --pretty='%Cred%h%Creset ​%Cgreen(%cr) %C(bold blue)<%an>%Creset ​-%C(auto)%d%Creset ​%s%n%b
-lga = log --graph --abbrev-commit --decorate --date=relative --format=format:'​%C(bold blue)%h%C(reset) - %C(bold green)(%ar)%C(reset) %C(white)%s%C(reset) ​%C(dim white)- %an%C(reset)%C(auto)%d%C(reset)' ​--all + diffc = diff --color-words=.
-co = checkout +
-diffc = diff --color-words=. +
-st = status+
 [status] [status]
 showUntrackedFiles = all showUntrackedFiles = all
 +[color "​diff-highlight"​]
 + oldNormal = red bold
 + oldHighlight = red bold 52
 + newNormal = green bold
 + newHighlight = green bold 22
 +[color "​diff"​]
 + meta = yellow
 + frag = magenta bold
 + commit = yellow bold
 + old = red bold
 + new = green bold
 + whitespace = red reverse
 +[diff-so-fancy]
 + changeHunkIndicators = true
 + markEmptyLines = true
 +[merge]
 +        conflictstyle = diff3
 +[rerere]
 + enabled = true
 + autoupdate = true
 </​code>​ </​code>​