Learning Git

Tips on learning Git as I moved my primary toolchain to Ubuntu 20.04 on WSL2

Getting started

Tips and tricks

  • Rename a local branch:
    git branch -m <old_name> <new_name>
  • Reset local repository branch to be just like remote repository HEAD:
    git fetch origin
    git reset --hard origin/master
  • Show just the files which changed in each commit:
    git log --name-only --oneline
  • Dangit, Git!?!
  • A brilliant "choose your own adventure style" tree On undoing, fixing, or removing commits in git - I find myself drawn to it, given it has questions like:

    Are you trying to find that which is lost or fix a change that was made?

  • Git commit message template

Going deeper