Would this be the equivalent of creating a branch, while working with a detached head in Git?
        Posted  
        
            by 
                Geo
            
        on Programmers
        
        See other posts from Programmers
        
            or by Geo
        
        
        
        Published on 2011-06-26T09:30:58Z
        Indexed on 
            2011/06/26
            16:30 UTC
        
        
        Read the original article
        Hit count: 269
        
git
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?
© Programmers or respective owner