git: Add an init template, use it to create the main branch
See
56d614f806
.
> This change adds a HEAD file to the Git template with a different ref.
This means that new repositories will commit to a "main" branch by
default instead.
This commit is contained in:
parent
0f797c6ffe
commit
b35d9a938a
1
rcrc
1
rcrc
|
@ -1,3 +1,4 @@
|
|||
COPY_ALWAYS="git_template/HEAD"
|
||||
DOTFILES_DIRS="$HOME/dotfiles-local $HOME/dotfiles"
|
||||
EXCLUDES="install.sh README.md"
|
||||
SYMLINK_DIRS="completion-scripts composer bin functions configs"
|
||||
|
|
1
tag-git/git_template/HEAD
Normal file
1
tag-git/git_template/HEAD
Normal file
|
@ -0,0 +1 @@
|
|||
ref: refs/heads/main
|
|
@ -100,6 +100,9 @@
|
|||
[include]
|
||||
path = ~/.gitconfig.local
|
||||
|
||||
[init]
|
||||
templatedir = ~/.git_template
|
||||
|
||||
[merge]
|
||||
ff = only
|
||||
|
||||
|
|
|
@ -1,13 +1,7 @@
|
|||
# No arguments: `git status`
|
||||
# With arguments: acts like `git`
|
||||
g() {
|
||||
if [[ $1 == init ]];
|
||||
then
|
||||
# Prefer "main" to "master"
|
||||
git "$@"
|
||||
git checkout -b main
|
||||
git branch -d master
|
||||
elif [[ $# > 0 ]];
|
||||
if [[ $# > 0 ]];
|
||||
then
|
||||
git $@
|
||||
else
|
||||
|
|
Loading…
Reference in a new issue