Last week, Zero2Hero organized two Git workshops in Vienna with Tim Berglund as trainer. I already worked through the Mastering Git and Mastering Advanced Git videos in the past (which I can highly recommend), so I didn’t expect great news here, but I didn’t wanted to miss the opportunity to meet Tim in person, so I booked the Advanced training – and I didn’t regret it!
So, here is my unsorted list of things I have learned (see also the shownotes):
- “git config --global credential.helper cache” caches the credentials for https authentication (default 15min)
- I have never used patch-mode adding (the “-p” option) yet, but I will try it soon (sadly IDEA doesn’t support it, but people say that e.g. SourceTree does). The “-p” option also works with “checkout” and “reset”.
- When rebasing, “git reflog” is your friend to find messed-up commits. To squash a whole branch, “git merge --squash [branchname]” is an alternative to interactive rebasing (but the merged branch must be forced-deleted afterwards)
- A possible way of undoing the last command is “git reset --hard HEAD@{1}” (move up the reflog)
- We were using p4merge as external diff/mergetool (a powerful, but expensive alternative is Araxis)
- Use “git fetch --prune” as replacement for “git remote prune origin”
- Use "git log -S [sometext]" find commits that introduced a given text
When discussing Git workflows, Tim stated that "Gitflow has too much opinions about the release process". He suggested to build your own development/release process based on Git, instead of using other’s biases.
Some participants (especially those who also booked the beginners training a day earlier) complained that the pace of the training was too fast and hard to follow, but I don’t agree: this was an “advanced” class, and for me the pace was very modest (and I am anything but a Git expert).