Information for: DEVELOPERS   PARTNERS

Correcting detached head problems with Git

When working in Live Development mode, attempting to push your changes using git push can occasionally fail with a message similar to the following:

You are in 'detached HEAD' state. You can look around, make experimental
changes and commit them, and you can discard any commits you make in this
state without impacting any branches by performing another checkout.

This detached head state occurs when a specific commit is checked out instead of a branch. You cannot commit to a commit—only to a branch. To correct this, use the following steps to create a branch for your commits:

  1. From a command prompt window, create a branch by using a command similar to the following:

    git checkout -b [branchname]
    
  2. Commit your changes to the branch.

  3. Push the branch that you created into the origin Git repository:

    git push origin [branchname]
    

Your Environment webpage will display the branch for deployment to each of your environments.