Skip to content

Commit

Permalink
Add git alias for Gitlab code reviews
Browse files Browse the repository at this point in the history
  • Loading branch information
pkissling committed Oct 26, 2023
1 parent 717f2bd commit 6bad26d
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
1 change: 1 addition & 0 deletions git/.gitconfig
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@
fuzzy-checkout-ticket = !bash -c 'source $HOME/.git/bin && git-fuzzy-checkout-ticket'
fuzzy-rebase = !bash -c 'source $HOME/.git/bin && git-fuzzy-rebase'
fuzzy-diff = !bash -c 'source $HOME/.git/bin && git-fuzzy-diff'
gitlab-review = !bash -c 'source $HOME/.git/bin && git-gitlab-code-review \"$1\"'

[core]
pager = delta --dark
Expand Down
6 changes: 6 additions & 0 deletions git/bin
Original file line number Diff line number Diff line change
Expand Up @@ -56,3 +56,9 @@ git-fuzzy-checkout-ticket() {
git cob dev/"${ticket_id}"_"${slug}"
git psu
}

git-gitlab-code-review() {
git fetch origin refs/merge-requests/"${0}"/head
git switch --detach FETCH_HEAD
git reset $(git merge-base HEAD $(git remote show origin | grep HEAD | sed 's/.* //'))
}

0 comments on commit 6bad26d

Please sign in to comment.