1

I'm trying to figure out how to change the default git branch from the command line (I know how to do this via the web page, but don't want to automate it using selenium).

The reason I want to do this is because i can't close issues unless the commit is on the default branch.

Any ideas?

1
  • You can't do this using the git command line, but you can do it using the REST API, so you could write a CLI tool to do this. I've closed this as a dupe of a question that addresses the API aspect of this.
    – larsks
    Sep 6, 2019 at 20:22

2 Answers 2

1

In your public repo this will remap HEAD from master to BRANCH_NAME

git symbolic-ref HEAD refs/heads/BRANCH_NAME

1
  • what i'm hoping to do is change the default branch in the settings->Branch option via the command line. Unfortunately this doesn't do that :(
    – WorkerBee
    Sep 6, 2019 at 20:03
-1

Usually you need to check out your 'default' branch (whatever name it has) and then merge your fixes into it:

git commit -m "commit changes in mybranch if i have some"
git checkout 'default-branch' # or whatever name of your default branch is (master?)
git merge 'mybranch' # merge your changes into the default branch
3
  • I don't want to merge into my default branch, i ideally just want to close issues over the cmd without it cluttering the history (the closing of issues will be automated)
    – WorkerBee
    Sep 6, 2019 at 20:04
  • if you collaborate with other folks, someone needs to merge your changes eventually in any case.
    – Serge
    Sep 6, 2019 at 20:43
  • i understand that but i don't want the automation to clutter up the history of the branch with just "Closed issue #9"
    – WorkerBee
    Sep 6, 2019 at 21:00

Not the answer you're looking for? Browse other questions tagged or ask your own question.