Reputation: 524
When I type git branch I get this.
* (HEAD detached from 731c587)
addNewJobQueueForCandidateProfileStore
master
I want everything on HEAD detached from 731c587
to be my final code and I suppose the final code of the project should always be on master?
Again, I'm not totally sure how git works, but I think this detached head is from the addNewJobQueueForCandidateProfileStore
branch. How can I merge the detached head into the addNewJobQueueForCandidateProfileStore
branch, and then the addNewJobQueueForCandidateProfileStore
branch into master?
In the end, I want to push this repo to git and have all my latest changes.
Upvotes: 0
Views: 872
Reputation: 524
Thank you everyone for the information.
I resolved conflicts and then I created a new branch called my-latest-changes
from the detached head state I was on. After that I creating a Pull request. Then I did git merge my-latest-changes
from master and everything is good now, I used git push origin master
to push my latest changes. (I made not have done all of these steps in the exact order, but this is what I did).
Upvotes: 0
Reputation: 60255
Branch refs are labels on commits. Really. If you want a label on that commit, add one. Or don't bother, just merge the history by its tip commit's id instead of some arbitrary invented name, the entire value of a mnemonic ref is threefold: it lets Git know you care about that history at the moment, it lets you associate notes like default command settings, and ... actually that's it. git commit
updates the HEAD
ref. When you check out a branch, git checkout
and its new little cousins turn the HEAD
ref into a temporary alias for another ref, the branch ref, so Git updates that instead when commands update HEAD
. That is, literally, all there is to it.
Upvotes: 1