Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve git aliases #2176

Merged
merged 3 commits into from
Nov 6, 2024
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 3 additions & 6 deletions aliases/available/git.aliases.bash
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,8 @@ alias gpatch='git format-patch -1'
# push
alias gp='git push'
alias gpd='git push --delete'
alias gpf='git push --force'
alias gpf='git push --force-with-lease'
NoahGorny marked this conversation as resolved.
Show resolved Hide resolved
alias gpff='git push --force'
alias gpo='git push origin HEAD'
alias gpom='git push origin $(get_default_branch)'
alias gpu='git push --set-upstream'
Expand Down Expand Up @@ -200,9 +201,5 @@ function gdv() {
}

function get_default_branch() {
if git branch | grep -q '^. main\s*$'; then
echo main
else
echo master
fi
git symbolic-ref refs/remotes/origin/HEAD | sed 's@^refs/remotes/origin/@@'
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would it be possible to use a bash substitution instead of farming out to sed?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes this is very much possible, good idea, changed it in the newest commit.
think I should squash it down later with the original commit if it looks good

}