Reputation: 1399
Hi I've this problem with git (it's all about problems)
I tried to sync my work this morning and got this:
and when I click "uncommited changes it doesn't show other than this. But I can't commit this either. It's a detached header.
What to do? :(
Upvotes: 0
Views: 508
Reputation: 1243
You're presaumbly in a detached HEAD state because, at some point, you checked out an arbitrary commit.
Is that the point at which you want to commit your changes? Or do you want to commit them to the tip of an existing branch such as master?
To create a branch from your current point use git checkout -b <new branch name>
... then you can commit your changes to that branch.
To commit to the tip of some other branch, you first need to check it out (e.g. git checkout master
). However, depending on the changes you've made since being in a detached head state, this may revert those changes (git won't lose your changes from its repository but they'll be harder to find ... which is probably not where you want to be).
The simplest option for you might be to create a branch from your current point, commit your changes to that branch, then check out your intended branch and merge. For example:-
git checkout -b newbranch
git commit -am 'my new changes'
git checkout master
git merge newbranch
Upvotes: 0
Reputation: 1328182
You could click on Tools -> Open a Shell Here
.
From the shell, you can run
git checkout master
' (or any other branch name you were in) to switch from the detached HEAD. git pull
' in the shell to pull down any new commits.Upvotes: 1