Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

How move HEAD on Remote Repository?

Dmitry Leyzerovich
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
November 30, 2022

Hi All,

In origin, I have two branches - default and master.

Currently, the HEAD in origin points to the branch named 'default', but the branch called master is defined as the MAIN branch.

So, how can I move the HEAD on the origin from the default branch to the master branch?

Thank you!

 

 

 

1 answer

0 votes
Theodora Boudale
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
December 2, 2022

Hi @Dmitry Leyzerovich and welcome to the community!

Could you please provide some more details as to where exactly you see the HEAD of the remote repo?

Are you perhaps referring to the reference located in .git/refs/remotes/origin/HEAD in your clone of the repo?

If so, this reference is set when you clone the repo, and a git fetch doesn't update it if you change the main branch after you clone.

If you changed the main branch after cloning the repo, you can use the following command to update this specific ref locally:

git remote set-head origin -a

This will work if the ref refs/remotes/origin/master exists already locally (otherwise you need to fetch it first).

See here for reference: https://git-scm.com/docs/git-remote#Documentation/git-remote.txt-emset-headem

Kind regards,
Theodora

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
TAGS
AUG Leaders

Atlassian Community Events