Hey,

This is a common mistake but Git should have yelled at you pretty well
when you did this.  You can't checkout a remote branch - only Git can
move those around.  They function as bookmarks of where your remote
repository branches are.  If you want to work on them, you have to
create a local branch based off of them.  Instead of :

$ git checkout origin/docs

you need to do something like

$ git checkout -b docs origin/docs

Which will create a local 'docs' branch that starts where the 'docs'
branch on your 'origin' remote was.  When you ran the 'git checkout
origin/docs' you should have seen a message like :

Note: moving to "origin/man" which isn't a local branch
If you want to create a new branch from this checkout, you may do so
(now or later) by using -b with the checkout command again. Example:
  git checkout -b <new_branch_name>

Which makes you work in what's called a 'detached HEAD', which is bad.
 Tom's right, if you run 'git reflog' you should be able to find your
commit.  The output will look something like this:

1939e48... h...@{0}: commit: help
67cb1a7... h...@{1}: checkout: moving from master to origin/man
621f1b4... h...@{2}: origin/master: updating HEAD
f8295af... h...@{3}: checkout: moving from next to master

If the top one is your commit, recover it by running something like:

$ git checkout -b mybranch 1939e48

(substitute the SHA for whatever SHA is in your list)

Hope that helps.

Scott

>> I was working on a fork which i pulled from git hub and .... may b i
>> should just give you the commands of what i did.
>>
>> $git clone <clone url here>
>> $git checkout origin/docs
>> <did lots of editing here but on only one file>
>> $git add <file name here>
>> $git commit
>> $git checkout master
>> I was sleepy and again opened the file to see no changes were done.
>> But when i woke up next day and again did
>> $git checkout origin/docs
>>
>> I couldn't find the changes. My logs confirm what i am saying. So plz
>> help me if you can.
>>
>>
>
>
>
> --
> Tom Preston-Werner
> github.com/mojombo
>
> >
>

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"GitHub" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/github?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to