1

I did changes on submodule and wanted to make pull request.

But currently getting "following Head detached from xxxx" error and I cant push it.

Do you know how can I solve it?

Error

HEAD detached from a9cd50a
nothing to commit, working tree clean
VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
Jan klemen
  • 21
  • 2
  • 2
    You can't do anything from a detached head state; all you can do is look around. You need to turn this into, or return to, an actual branch. – matt Sep 24 '21 at 00:01
  • It's not an error. You can use `HEAD` to refer to it. To push the detached head to the branch `foo`, use `git push origin HEAD:foo`. If the push results in an error about non-fast-forward, use `git pull origin foo` or `git pull origin -r foo` before a next push. – ElpieKay Sep 24 '21 at 03:48

1 Answers1

0

A submodule is always checked out as detached head, unless you set the relevant configuration:

From the submodule folder, you can:

  • list its remote branches: git fetch + git branch -avv
  • switch to a new PR branch of your choice: git switch -c a_new_PR
  • add your commit, and push (assuming you have the right to push to the upstream submodule repository, because you are its owner or a member: otherwise, you need to reference as submodule a fork of your own)
VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250