Would this be the equivalent of creating a branch, while working with a detached head in Git?
- by Geo
Let's say I checked out a version different than HEAD. Let's say I made some commits, and so an anonymous branch was created. Afterwards I may have checked out a different branch, so now the only way to get to my commits is via reflog.
If do this:
>> git reflog | grep -i mycommit
sha1hash
>> git branch reattaching
>> git cherry-pick hash_of_commits
>> git checkout master
>> git merge reattaching
Is it the equivalent of:
>> git reflog | grep -i mycommit
sha1hash
>> git branch reattaching sha1hash
>> git checkout master
>> git merge reattaching
What happens to the detached head commits, as I think that via cherry-picking, they will exist in 2 places. Will they forever remain in my repository?