Git Saved My Career

Commands you should know

https://dev.bleacherreport.com/small-commits-for-fun-and-profit-part-2-git-commit-amend-and-git-rebase-interactive-e986d4a64c21
$ git commit --ammend
$ git status
$ git show 1c10ff5
$ git rebase -i

https://stackoverflow.com/questions/56230353/to-what-extent-does-using-squash-or-fixup-successfully-scrub-data-from-github

> What we’re doing here is called “rewriting history”, and that should sound dangerous.

git config --global rerere.enabled true
$ tree .git/rr-cache
.git/rr-cache
└── f08b1f478ffc1376
    ├── postimage
    └── preimage

Aliases

# ~/.gitconfig OR .git/config


[alias]
    pu = !git push -u origin $(git rev-parse --abbrev-ref HEAD)

 

via Brian Schiller - @bgschiller

[alias]

    recent = "!f() {git for-each-ref --count=${1:-10} --sort=-committerdate refs/heads/ --format='%(refname:short)'; }; f"

    cor = !git recent 25 | fzf --reverse --nth=1 --preview 'git log --patch --color {1}...{1}~5' | awk '{print $1}' | xargs git checkout

via Nathan Witmer - @zerowidth

Hooks

$ vi .git/hooks/pre-commit
#!/bin/sh
flake8 .

https://medium.com/@importpython/comply-with-pep8-using-flake8-and-git-pre-commit-hooks-it-will-take-just-a-minute-39a343ded293

https://github.com/pre-commit/pre-commit-hooks/tree/master/pre_commit_hooks

Philosophy

https://geshan.com.np/blog/2016/04/3-simple-rules-for-less-or-no-git-conflicts/

https://www.atlassian.com/git/tutorials/comparing-workflows

Git Saved My Career

By Vincent Buscarello

Git Saved My Career

  • 202