Skip to content

Commit

Permalink
Update dotfiles
Browse files Browse the repository at this point in the history
  • Loading branch information
cezarmathe committed May 16, 2024
1 parent 96fcf56 commit a048a92
Show file tree
Hide file tree
Showing 10 changed files with 50 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/.config/git/config
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
name = Armand-Cezar Mathe
[init]
defaultBranch = main
#[credential]
# helper = ~/bin/git-credential-helper

[push]
autoSetupRemote = true
[diff]
tool = nvimdiff
12 changes: 12 additions & 0 deletions src/.config/git/gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -20,3 +20,15 @@
.old

.envrc

# Cloud credentials and configuration
.aws
.gcloud

.ctags
.ctags.gen

*.log

# .ignore directories for temporarily hiding something.
.ignore
3 changes: 3 additions & 0 deletions src/.local/bin/git-checkout-branch
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/usr/bin/env bash

git select-branch | xargs git checkout
9 changes: 9 additions & 0 deletions src/.local/bin/git-checkout-pr
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#!/usr/bin/env bash

if [[ -z "$1" ]]; then
echo "Usage: git-checkout-pr <pr-number>"
exit 1
fi

git fetch origin +refs/pull/*:refs/remotes/origin/pr/*
git checkout -b "pr/$1" "origin/pr/$1/head"
3 changes: 3 additions & 0 deletions src/.local/bin/git-delete-branches
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/usr/bin/env bash

git branch | fzf -m | tr -d ' ' | xargs git branch -D
5 changes: 5 additions & 0 deletions src/.local/bin/git-diff-commit
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!/usr/bin/env bash

COMMIT="$(git select-commit)"
exec git difftool "${COMMIT}~" $"${COMMIT}" @

5 changes: 5 additions & 0 deletions src/.local/bin/git-main
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!/usr/bin/env bash

MAIN="$(git config --get init.defaultBranch)"

exec git checkout "${MAIN}"
3 changes: 3 additions & 0 deletions src/.local/bin/git-rebase-branch
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/usr/bin/env bash

git rebase -i "$(git select-branch)"
3 changes: 3 additions & 0 deletions src/.local/bin/git-select-branch
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/usr/bin/env bash

git branch | fzf | tr -d ' '
3 changes: 3 additions & 0 deletions src/.local/bin/git-select-commit
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/usr/bin/env bash

git log --oneline | fzf | cut -d ' ' -f 1

0 comments on commit a048a92

Please sign in to comment.