Open Laboratory for Technocrats

Grab the developer role, learn concepts & prepare with senior software engineers to get solutions for problems in a software job. Coding and Programming Solutions crafted for you.

GIT Tips




  • git add -p
    • -p allow to step through each change for commit or not
  • git log -5 --pretty --oneline
    • 5 lastest commits on their own line
  • git shortlog -sn
    • list of contributors and how many commits each person has
  • git log --all --graph --decorate --oneline --simplify-by-decoration
    • decorate the details run and see this 
  • git checkout pr/123
    • checkout a remote for PR/ pull request review
  • git diff --shortstat "@{0 day ago}"
    • how many line of code written today\
  • git checkout
    • change branch
  • git reset --soft HEAD~3
    • soft reset will keep changes but allow to uncommit something
  • git reflog
    • check every step you did and its stored in git step by step
  • git stash and git stash pop
    • save changes and then get it back
  • git log -S puppy
    • search commit history with word puppy
  • git latest = for-each-ref --count=30 --sort=-committerdate refs/heads. --format='%(refname:short)'
    • view your latest branchces
  • git config --global help.autocorrect -1
    • re run the correct command if u mistype or spelled
  • git commit --amend
    • squashing staged files in last commit
  • git cherry-pick [hash]
    • long as the commit has been fetched somewhere, you can cherry pick that code in your own branch without having to merge the entire thing
  • git remote update --prune
    • Remove local branches that have been deleted from your remote (like GitHub). You can always run git remote prune origin --dry-run to see what will be deleted before going all in
  • git rebase -i HEAD~4
    • rebase allows you to pick and choose which commits you can pick, squash, reword, edit, or fixup

Top #3 Articles

Most Read