Let's agree, no matter what language you code in, developers life is incomplete without using git.
These are some notes from recent video I watched about git-workflow from Gary
Bernhart's . He shows some cool demonstration of git aliases and workflow he follows.
The git config can be directly used by replacing the .gitconfig and adding the .githelpers at [2].
Prerequisite : You must install diff-so-fancy from [1] and add it's lib folder to the system PATH
I guess I can now live without GitKraken at some point..
Usage (alias):
[alias]
- st = status
- ci = commit --verbose
- co = checkout
- di = diff --find-copies-harder
- dc = diff --find-copies-harder --cached
- amend = commit --amend
- aa = add --all
- ff = merge --ff-only
- noff = merge --no-ff
- fa = fetch --all
- pom = push origin master
- ds = diff --stat=160,120
- dh1 = diff HEAD~1
- # Divergence (commits we added and commits remote added)
- div = divergence
- # Goodness (summary of diff lines added/removed/total)
- gn = goodness
- gnc = goodness --cached
- # Fancy logging.
- # h = head
- # hp = head with patch
- # r = recent commits, only current branch
- # ra = recent commits, all reachable refs
- # l = all commits, only current branch
- # la = all commits, all reachable refs
- # b = all branches.
- # bs = all branches, sorted by last commit date
- head = !git r -1
- h = !git head
- hp = "!. ~/.githelpers && show_git_head"
- r = !GIT_NO_PAGER=1 git l -30
- ra = !git r --all
- l = "!. ~/.githelpers && pretty_git_log"
- la = !git l --all
- b = "!. ~/.githelpers && pretty_git_branch"
- bs = "!. ~/.githelpers && pretty_git_branch_sorted"
- ski = !git stash --keep-index
- cp = cherry-pick
- pf = push --force-with-lease
- //do a git ra first
- run-command-on-git-revisions <from revision> <to revisoin> 'java test?'
Reference:
- [1] https://github.com/so-fancy/diff-so-fancy
- [2] https://github.com/garybernhardt/dotfiles/blob/master/bin/run-command-on-git-revisions
- https://www.destroyallsoftware.com/screencasts/catalog/git-workflow
- https://joefleming.net/posts/more-git-magic/
- https://github.com/garybernhardt/dotfiles/blob/master/.gitconfig
- https://github.com/garybernhardt/dotfiles/blob/master/.githelpers
- https://github.com/garybernhardt/dotfiles/blob/master/bin/run-command-on-git-revisions
Comments
Post a Comment