nb icon indicating copy to clipboard operation
nb copied to clipboard

Handling default git branch names

Open selectric401 opened this issue 3 years ago • 3 comments

When setting up a new notebook and adding a remote, it may be useful to be able to specify the branch name as part of nb remote set, or to be able to set a default in the configuration somewhere. I've set up my local Git server to default to main instead of master, and GitHub has changed its default for new repositories too. This can be worked around with by running nb git branch -m master main after setting the remote, but a notebook-level or global-level configuration option would probably help as more Git repos default to main.

selectric401 avatar Oct 25 '20 21:10 selectric401

I just experienced the same thing.

In my case, I also needed to run:

$ nb git push origin main

nertzy avatar Oct 27 '20 01:10 nertzy

I'm working my way toward addressing this. In the meantime I've been keeping this in mind over the past few months and nb should be branch-name agnostic, though as you noticed there isn't a lot of branch handling logic yet.

For reference, nb uses git init when creating notebooks, so the default branch name should reflect the setting in git config --global init.defaultBranch. When syncing, nb just uses the the current branch name.

xwmx avatar Nov 03 '20 18:11 xwmx

if your using nb sync on a remote that your adding for an existing notebook that already exists, nb still complains that it can't find the master branch. keep having to use nb git branch -m master main

bscott avatar Feb 25 '21 06:02 bscott