Skip to content

Instantly share code, notes, and snippets.

@dazza-codes
Created December 6, 2022 00:38
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dazza-codes/1258dad4464eebbcd980b43e6215f553 to your computer and use it in GitHub Desktop.
Save dazza-codes/1258dad4464eebbcd980b43e6215f553 to your computer and use it in GitHub Desktop.
Useful git commands and functions

Git Macro Functions

#### Cutting a release with a log of recent pull requests merged to master
git_release_commits () {
  git pull
  git fetch -p
  git log --oneline --decorate | grep 'Merge pull request' | head -n25
}

Git Config

[user]
	email = your.name@github.com
	name = Your Name
[alias]
        changelog = log --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %C(bold blue)%an <%ae>%Creset' --abbrev-commit --decorate
        ll = log --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)%an <%ae>%Creset' --abbrev-commit -n 15
        ir = rebase -i 
[core]
	excludesfile = ~/.gitignore
[gpg]
	program = /usr/bin/gpg
[init]
	defaultBranch = main
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment