Skip to content

Instantly share code, notes, and snippets.

@igordrnobrega
Last active August 28, 2024 13:27
Show Gist options
  • Select an option

  • Save igordrnobrega/1c0509c777845eba9e5890636c675a24 to your computer and use it in GitHub Desktop.

Select an option

Save igordrnobrega/1c0509c777845eba9e5890636c675a24 to your computer and use it in GitHub Desktop.
git-aliases

Aliases

Pure git

Publish

git config --global alias.publish '!git up && git push'

Push force with lease

git config --global alias.pf 'push --force-with-lease'

Rebase autosquash

git config --global alias.up 'pull --rebase --autostash'

Last hash

git config --global alias.last-hash 'log -1 --pretty=%h --abbrev=7'

Amend

git config --global alias.amend 'commit --no-edit --amend'

GH CLI dependent

Pull Request with title from commit hash

git config --global alias.pr '!f() { title=$(git show -s --format=%s "$1"); git pf && gh pr create --fill --title "$title"; }; f'

Open Browse

git config --global alias.browse '!gh browse'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment