git/list[1] front-page[2] threads[3] people[4] search[5] about
 

RE: BUG

From
Randall S. Becker <rsbecker@nexbridge.com>
Date
Nov 4, 2020, 17:02 UTC
Message-ID
<037901d6b2cc$5362e170$fa28a450$@nexbridge.com>
In-Reply-To
<CALG6MqwdCmwS5D_F9+q6UYzGm5ZzLL7Bi=rD7Ph2XE0uccu+xg@mail.gmail.com>
On November 4, 2020 11:10 AM, Alex Marginean wrote:
Show 12 quoted lines
> Github has changed the way they name branches, so now instead of the
> `master` branch there is the `main` branch however, I'm having some trouble
> with the naming
> 
> **Steps to replicate my problem**
> 
> 1. Create a new Github repository and make sure the default branch is `main`
> 2. Add something to the repo, a `README.md` file should be enough 3.
> Instead of cloning the repo make a new directory with your repo's name
> `mkdir <repo_name>` and change the directory to it `cd <repo_name>` 4. `git
> init` 5. Add the remote repo with `git remote add origin <repo_link>` 6. Pull
> the `main` branch from the remote repo with `git pull origin main`.
Use git init --initial-branch=main
This assumes a recent version of git.
Show 14 quoted lines
> 
> After the step number 6. instead of my branch changing to `main` my current
> branch is changed to `master` which has every file and change of the branch
> `main`. This is a real problem because if I try to push changes to `main`
> although my current branch shows up as `master` it creates another branch
> called `master` on Github and the `main` remains unchanged. Yeah sure I can
> `git checkout main` after that and make my changes there but I'm not sure
> why it defaults to `master` and copies `main` from Github into local branch
> `master`.
> 
> P.S. If you were to use `git fetch origin` instead of `git pull origin
> <branch_name> and then manually change branch to `main` with `git
> checkout main` it would work. Also, if you were to clone the Github repo
> using `git clone <link>` you will get the correct current branch that is `main`.
Regards,
Randall
-- Brief whoami:
 NonStop developer since approximately 211288444200000000
 UNIX developer since approximately 421664400
-- In my real life, I talk too much.
Previous: Alex MargineanNext: Randall S. Becker
Message 2 of 3 in “BUG”
  1. Alex MargineanNov 4, 2020
  2. Randall S. BeckerNov 4, 2020
  3. Randall S. BeckerNov 4, 2020

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.