Setup bash ~/eibhear_org/scripts/gitDemo.sh bash ~/eibhear_org/Version1/TechTalks/merge-setup.sh gpg2 --generate-key git config --global gpg.program gpg2 Slide: Configuration git config --list cd ~/tmp/DeepDive1 git config --local --list git config --global --list git config --system --list git config --global user.name "Éibhear Ó hAnluain" git config --global user.email "eibhear.ohanluain@version1.com" git config -e # Slide Slide: fetch and merge, not pull cd ~/tmp/gitDemo/javaBootcampNoEclipse.dev1 git fetch --prune # Slide git branch -va # Slide Slide: Merging approaches: fast-forward cd ~/tmp/DeepDive1 git checkout master git log --decorate --graph --oneline --all git merge Rel1 # Slide git log --decorate --graph --oneline --all # Slide Slide: Merging approaches: merging strategies cd ~/tmp/DeepDive1 git checkout master git merge Rel2 git log --decorate --graph --oneline --all # Slide Slide: Merging approaches: Rebase bash ~/eibhear_org/Version1/TechTalks/merge-setup.sh cd ~/tmp/DeepDive1 git checkout master git log --decorate --graph --oneline --all git merge Rel1 git log --decorate --graph --oneline --all git checkout Rel2 git rebase master # Slide git log --decorate --graph --oneline --all # Slide Slide: refs bash ~/eibhear_org/Version1/TechTalks/merge-setup.sh cd ~/tmp/DeepDive1 ls -l .git/refs/heads/ cat .git/refs/heads/Rel2 # Slide git tag Rel1.0 Rel1 cat .git/refs/heads/Rel1 cat .git/refs/tags/Rel1.0 cat .git/HEAD # Slide cd ~/tmp/gitDemo/javaBootcampNoEclipse.dev1 ls -l .git/refs/remotes/origin/ cat .git/packed-refs # Slide Slide: Annotated tags cd ~/tmp/DeepDive1 cat .git/refs/tags/Rel1.0 git cat-file -t $(cat .git/refs/tags/Rel1.0) git cat-file -p $(cat .git/refs/tags/Rel1.0) # Slide git tag -a -m "Formal release of 1.0" Rel1.0.prod Rel1 cat .git/refs/tags/Rel1.0.prod git cat-file -t $(cat .git/refs/tags/Rel1.0.prod) git cat-file -p $(cat .git/refs/tags/Rel1.0.prod) # Slide Slide: blame git blame information.md git checkout Rel1 git blame information.md git merge Rel2 git blame information.md # Slide Slide: Tag and commit signing gpg --list-secret-keys git checkout master # Edit information.md git commit -a -Seibhear.ohanluain@version1.com -m "Update to information.md" git cat-file -p master git tag -s -u eibhear.ohanluain@version1.com -m "Release 2." Rel2.0 Rel2 git cat-file -p Rel2.0 # Slide git tag -v Rel2.0 git log --show-signature -1 # Slide Slide: Git Objects -- blobs cat ~/.bash_history | git hash-object --stdin # Slide Slide: Git Objects -- trees cd ~/tmp/gitDemo/javaBootcampNoEclipse.dev1 cat .git/refs/heads/master git cat-file -p # Slide Slide: Git Objects -- commits cd ~/tmp/DeepDive1 git log --graph --all --decorate --oneline git cat-file -p HEAD git cat-file -p # Slide Slide: Git Objects -- tags git cat-file --batch-check='%(objecttype) %(objectname) %(objectsize)' --batch-all-objects | grep tag git cat-file -p # Slide Slide: "Content Addressable Filesystem" git rev-list --all --objects git cat-file -p git cat-file -p | git hash-object --stdin ls -l .git/objects/... # Slide Slide: The reflog git reflog git reflog expire --expire=now --expire-unreachable=now --verbose --all git reflog # Slide Slide: fsck and gc git fsck git gc # Slide Slide: Useful commands bash ~/eibhear_org/Version1/TechTalks/largeFile-setup.sh cd ~/tmp/DeepDive1 git cat-file --batch-check='%(objecttype) %(objectname) %(objectsize)' --batch-all-objects | sed -n 's/^blob //p' | sort -n --key=2 git rev-list --objects --all | grep git log --follow -- "largeInformation.md" # Slide Slide: Permanently removing a file from your git db [1/2] for tag in $(git tag) do echo "${tag},$(git log --format="%H,\"%cn\",\"%ci\",\"%s\"" ${tag} | head -1)" done | tee ../tag_list.csv for branch in $(git branch -r | grep -v HEAD | sed 's/\ \ origin\///') do git checkout ${branch} done for branch in $(git branch | sed 's/^..//') do git checkout -q ${branch} du -sk . | sed "s/\./${branch}/" done | tee ../branch_sizes.out # Slide git checkout Rel1 # Slide git filter-branch --tree-filter 'rm -f largeInformation.md' --prune-empty HEAD # Slide git for-each-ref --format="%(refname)" refs/original/ | xargs -n 1 git update-ref -d # Slide for branch in Rel2 Rel3 Rel4 master do git checkout ${branch} git filter-branch --tree-filter 'rm -f largeInformation.md' --prune-empty HEAD git for-each-ref --format="%(refname)" refs/original/ | xargs -n 1 git update-ref -d done | tee ../cleanup.out # Slide git reflog expire --expire-unreachable=now --all # Slide git gc --prune=now # Slide git fsck --unreachable --no-reflogs # Slide for branch in $(git branch | sed 's/^..//') do git checkout -q ${branch} du -sk . | sed "s/\./${branch}/" done | tee ../branch_sizes_post_process.out # Slide # End