git: Add main branch methods, Fix pushall

Fixed 'pushall' option xargs error.

Added dealing with 'main' branch instead of 'master' branch in checkout
and rebase aliases, so that when invoking the commands it will default
to a master branch and fall back to a main branch before complaining
that no corresponding branch exists.

Should (silently) fix git repositories which switched to main in the
last few months, and simultaneously allows me to switch this repository
to main branch (already done.)
This commit is contained in:
Marty Oehme 2021-03-14 13:02:47 +01:00
parent b2af424d31
commit 78e678fe1f
Signed by: Marty
GPG key ID: B7538B8F50A1C800
2 changed files with 17 additions and 18 deletions

View file

@ -2,25 +2,19 @@
email = marty.oehme@gmail.com email = marty.oehme@gmail.com
name = Marty Oehme name = Marty Oehme
signingkey = B7538B8F50A1C800 signingkey = B7538B8F50A1C800
[filter "lfs"] [init]
clean = git-lfs clean -- %f defaultBranch = main
smudge = git-lfs smudge -- %f
process = git-lfs filter-process
required = true
[alias] [alias]
ignore = "!gitignore -f" ignore = "!gitignore -f"
pushmerge = "push -o merge_request.merge_when_pipeline_succeeds" # see https://docs.gitlab.com/ce/user/project/push_options.html#merge-when-pipeline-succeeds-alias pushmerge = "push -o merge_request.merge_when_pipeline_succeeds" # see https://docs.gitlab.com/ce/user/project/push_options.html # merge-when-pipeline-succeeds-alias
last = "diff HEAD~ HEAD" last = "diff HEAD~ HEAD"
# push to all connected remotes pushall = "!git remote | xargs -I R git push R" # push to all connected remotes
pushall = "!git remote | xargs -L1 -I R git push R"
[commit] [commit]
# sign commits as me gpgsign = true # sign commits as me
gpgsign = true verbose = true # Always show diff when preparing commit message
# Always show diff when preparing commit message
verbose = true
[fetch] [fetch]
# remove references to non-existent remote branches prune = true # remove references to non-existent remote branches
prune = true
[pull] [pull]
rebase = true # always rebase on pulling, obviates merge commits rebase = true # always rebase on pulling, obviates merge commits
[diff] [diff]
@ -51,3 +45,8 @@
[url "git@gitlab.com:"] [url "git@gitlab.com:"]
pushInsteadOf = "https://gitlab.com" pushInsteadOf = "https://gitlab.com"
pushInsteadOf = "http://gitlab.com" pushInsteadOf = "http://gitlab.com"
[filter "lfs"]
clean = git-lfs clean -- %f
smudge = git-lfs smudge -- %f
process = git-lfs filter-process
required = true

View file

@ -18,7 +18,7 @@ alias gc='git commit -v'
alias gc!='git commit -v --amend' alias gc!='git commit -v --amend'
alias gcn!='git commit -v --no-edit --amend' alias gcn!='git commit -v --no-edit --amend'
alias gcm='git checkout master' alias gcm='git checkout master 2>/dev/null || git checkout main'
alias gcd='git checkout develop' alias gcd='git checkout develop'
alias gcb='git checkout -b' alias gcb='git checkout -b'
alias gco='git checkout' alias gco='git checkout'
@ -55,7 +55,7 @@ alias grs!='git restore'
alias grb='git rebase' alias grb='git rebase'
alias grbi='git rebase -i' alias grbi='git rebase -i'
alias grbc='git rebase --continue' alias grbc='git rebase --continue'
alias grbm='git rebase master' alias grbm='git rebase master || git rebase main'
alias gst='git status' alias gst='git status'