Git is a fantastic developer tool but it’s a messy tool. Below is a collection of my notes and references, which I collected while trying to tame this beast.

  • Git 101
    • Pretty awesome article to begin with: Link
    • To the point git tutorial with great configuration commands: Link
  • See git tree in terminal
    • Once you get the basics, you would want to see the tree and branches of your repo. This is especially handy when you are working with remote servers like AWS, rackspace et al. View tree log in terminal: Link
    • Quick command to see tree in terminal:
      git config --global alias.tree 'log --graph --full-history --all --color --date=short --pretty=format:"%Cred%x09%h %Creset%ad%Cblue%d %Creset %s %C(bold)(%an)%Creset"'
  • Merge Conflicts
    • Once you have come this far, you will definitely face merge conflicts. Here is a definitive reference explaining how to fix merge conflicts: Link
    • To check the status of local vs remote files (which branches are outdated etc): git remote show
    • Can use git fetch too. Never use git pull, it will fetch and merge whatever it wants to. Can fuck up things
    • To check what changes will be made if you Fetch the remote
      git diff HEAD /
    • Use the following command to check the available diff/merge tools git mergetool --tool=
    • To use vimdiff install vim: sudo apt-get install vim and then run the following:
      git config --global diff.tool vimdiff git config --global difftool.vimdiff.cmd "vimdiff $LOCAL $REMOTE"
      Now run git difftool to diff
    • picked from: Link
  • Some tricks
    • Show branch name in the bash: Link

SHARE
Previous articleCloning EC2 instance
Next articleRant without a Rhyme
My name is Talvinder Singh, I build internet products. I am a philomath, a seeker of knowledge. I am an award winning 30 year old internet professional from India who designs, develops, consults, speaks and writes about building high quality, accessible internet products.

LEAVE A REPLY

Please enter your comment!
Please enter your name here