Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Git - shared insights

Git - shared insights

What my team and I are doing with Git every day.

Markus Hanses

December 20, 2018
Tweet

More Decks by Markus Hanses

Other Decks in Technology

Transcript

  1. Agenda • Git tools • Git config, Git config files

    • Gitignore files • Branching, merging, rebasing • Pulling • Squashing, amend commit • Git Workflow, Feature Branch Workflow • Workflow of my team • Demo • Hints
  2. # Lists the git config git config -l git config

    --global -l # Sets colored output git config --global color.ui auto # Sets converting of LF endings into CRLF git config --global core.autocrlf input # for mac and linux git config --global core.autocrlf auto # for windows # Sets user details git config --global user.name "Markus Hanses" git config --global user.email "[email protected]" Git config
  3. Git config files cat ~/.gitconfig cat repo/.git/config [user] name =

    Markus Hanses email = [email protected] [core] excludesfile = .gitignore_global autocrlf = input [color] ui = auto ... [core] ... [remote "origin"] url = ... fetch = ... [branch "master"] remote = origin merge = refs/heads/master ...
  4. branching 1/2 (create) git checkout -b feature_one git add .

    git commit -m “Your message” git push --set-upstream origin feature_one
  5. Merging (No fast forward) git checkout master git merge --no-ff

    feature_four -m 'add new feature' git push
  6. Pulling (merge) git pull # git fetch & git merge

    Quelle: https://de.atlassian.com/git/tutorials/syncing/git-pull
  7. Hints 1/2 (Save time) # Sets the push strategy to

    'use the same name on remote' git config --global push.default simple # Deletes local references for deleted remote branches git config --global fetch.prune 1 # Store passwords in MAC OS password manager git config --global credential.helper osxkeychain # Create an alias for an compressed log output git config --global alias.ultimate-log "log --graph --oneline --decorate"
  8. Hints 1/2 (Clean repository) # Removes all merged local branches,

    but 'master' branch git branch | grep -v "master" | xargs git branch -d # Removes all remote branches, merged into master git branch -r --merged master | \ ack -v master | \ sed -e 's/\// :/' | \ xargs -n2 git push
  9. Recommended sources • GIT Website, https://git-scm.com/docs • Bitbucket Website, https://de.atlassian.com/git/tutorials

    • Git in Practice, Mike McQuaid, Manning • Pro Git 2nd Edition, Scott Chacon and Ben Straub, apress