1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 | git config --global alias.br branch
git config --global alias.cm "commit -v"
git config --global alias.co checkout
git config --global alias.di diff
git config --global alias.diw "diff --word-diff=color"
git config --global alias.dis "!git --no-pager diff --stat"
git config --global alias.fe fetch
git config --global alias.log1 "log --oneline --graph --decorate"
git config --global alias.log1a "log --oneline --graph --decorate --all"
git config --global alias.rbu "rebase --interactive --autosquash HEAD@{upstream}"
git config --global alias.rbi "rebase --interactive --autosquash"
git config --global alias.rb "rebase --autosquash"
git config --global alias.st status
git config --global diff.wordregex "[a-zA-Z0-9_]+|[^[:space:]]"
git config --global core.pager "less -RS"
git config --global color.ui "auto"
git config --global merge.conflictstyle diff3
git config --global rebase.autosquash true
git config --global "url.git@git.becs.aalto.fi:.insteadof" "becs:"
git config --global "url.git@git.becs.aalto.fi:rkdarst/.insteadof" "becsrkd:"
|
The following aliases are put here for copy-and-paste purposes, but discussed later in the talk.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 | git config --global core.excludesfile ~/.gitignore
git config --global alias.new "log HEAD..HEAD@{upstream}"
git config --global alias.news "log --stat HEAD..HEAD@{upstream}"
git config --global alias.newd "log --patch HEAD..HEAD@{upstream}"
git config --global alias.newdi '!git diff "$(git merge-base HEAD HEAD@{upstream})..HEAD@{upstream}'
git config --global alias.rec "!git --no-pager log --oneline --graph --decorate -n5"
git config --global alias.reca "!git --no-pager log --oneline --graph --decorate -n10 --all"
git config --global alias.recu "!git --no-pager log --oneline --graph --decorate @{upstream}^..HEAD"
git config --global difftool.latexdiff.cmd '/proj/networks/darst/bin/git-latexdiff-helper "$LOCAL" "$REMOTE"'
git config --global alias.latexdiff "difftool -t latexdiff"
git config --global difftool.diffpdf.cmd 'diffpdf "$LOCAL" "$REMOTE"'
git config --global alias.diffpdf "difftool -t diffpdf"
|
GUIs include:
Unfortunately, I don't use the GUIs that much, so I can't compare them too much.
I will try to go show the GUI use for each thing we do in this talk.
Let's review how git commits work.
All git commits form a giant directed acyclic graph.
This is done on the board.
Merges
Rebases
This is done on the board.
alias: git st
Shows you:
Use your .gitignore file well!
You can use one standard gitignore file across all repos:
1 | git config --global core.excludesfile ~/.gitignore
|
Use ~/.gitignore (in your home directory) to ignore common things
My .gitignore file is this:
*~ .#*# *.pyc *.pyo
alias: git log1a
This visually shows:
This single command has taught me more about git than anything else.
This uses one of my aliases, and is equivalent to git log --oneline --graph --decorate --all.
If you want to see the annotation of a file at some point in the past, use git annotate <filename> <commit-id>.
The rec and new commands require the upstream brranch (tracking branch) to be set right. git branch --set-upstream
1 2 3 4 5 6 7 8 git config --global alias.new "log HEAD..HEAD@{upstream}" git config --global alias.news "log --stat HEAD..HEAD@{upstream}" git config --global alias.newd "log --patch HEAD..HEAD@{upstream}" git config --global alias.newdi "!git diff $(git merge-base HEAD HEAD@{upstream})..HEAD@{upstream}" git config --global alias.rec "!git --no-pager log --oneline --graph --decorate -n5" git config --global alias.reca "!git --no-pager log --oneline --graph --decorate -n10 --all" git config --global alias.recu "!git --no-pager log --oneline --graph --decorate @{upstream}^..HEAD"
Try using the recu command (above) to see what is new.
Files are here:
Conflicts are one of the most confusing things for people.
Notice that half of these commands are "carefully examine the situation". This is for a reason!
Files are here:
Config options:
1 2 | git config --global difftool.latexdiff.cmd '/proj/networks/darst/bin/git-latexdiff-helper "$LOCAL" "$REMOTE"'
git config --global alias.latexdiff "difftool -t latexdiff"
|
Usage: git latexdiff filename.tex
You must use the filename.tex argument or it won't work.
Normal diff specification options work, such as git diff <commit-id-1>..<commit-id-2> filename.tex
The path /proj/networks/darst/bin/git-latexdiff-helper works on BECS computers. I found the prototype of this script online, and modified it to work better for papers with figures, bibtex, etc. If something doesn't work right (which will happen sometimes), let me know.
A public release with installations instructions is at https://github.com/rkdarst/git-latexdiff. It hasn't been tested much on other systems!
Config options:
1 2 | git config --global difftool.diffpdf.cmd 'diffpdf "$LOCAL" "$REMOTE"'
git config --global alias.diffpdf "difftool -t diffpdf"
|