Skip to content

Make git aliases agnostic of git default branch name#120

Merged
ssaunier merged 2 commits intomasterfrom
make-git-aliases-agnostic-of-git-default-branch-name
Aug 29, 2022
Merged

Make git aliases agnostic of git default branch name#120
ssaunier merged 2 commits intomasterfrom
make-git-aliases-agnostic-of-git-default-branch-name

Conversation

@dmilon
Copy link
Copy Markdown
Contributor

@dmilon dmilon commented Aug 19, 2022

Fix #119

@dmilon dmilon self-assigned this Aug 19, 2022
Comment on lines +26 to +27
# Set remotes/origin/HEAD -> defaultBranch (copied from https://stackoverflow.com/a/67672350/14870317)
remoteSetHead = remote set-head origin --auto
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

If the git repo has not been cloned from GitHub but has been created locally instead, the remotes/origin/HEAD -> origin/master symbolic-ref doesn't exist and the git defaultBranch alias returns fatal: ref refs/remotes/origin/HEAD is not a symbolic ref

Running git remoteSetHead once will then set the symbolic-ref and the git defaultBranch will now work.

@dmilon dmilon requested review from Eschults and ssaunier August 19, 2022 14:59
@ssaunier ssaunier merged commit 75f4d71 into master Aug 29, 2022
@ssaunier
Copy link
Copy Markdown
Member

🙌

@ssaunier ssaunier deleted the make-git-aliases-agnostic-of-git-default-branch-name branch August 29, 2022 16:13
bogumilo added a commit to bogumilo/dotfiles that referenced this pull request Sep 15, 2022
Merge pull request lewagon#120 and branch changes
thmsmrl added a commit to thmsmrl/dotfiles that referenced this pull request Oct 10, 2022
…-of-git-default-branch-name

Make git aliases agnostic of git default branch name
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

git sweep should also work on main branch

2 participants