github - Git lost local commited files after git checkout -


i switching different branch can push. while doing checkout files open in editor may have caused permission denied error. did git lose files? dont know how them back. here did - files lost js/messages directory templates/messages directory these open in editor when doing git operations

c:\users\***\documents\myproject>git pull password 'https://********@bitbucket.org': up-to-date.  c:\users\***\documents\myproject>git checkout paymentmodule error: cannot stat 'www/js/messages': permission denied error: cannot stat 'www/js/messages': permission denied error: cannot stat 'www/templates/messages': permission denied  c:\users\***\documents\myproject>git checkout paymentmodule switched branch 'paymentmodule'  c:\users\***\documents\myproject>git push origin paymentmodule password 'https://******@bitbucket.org': https://*******@bitbucket.org/********/myproject.git  ! [rejected]        paymentmodule -> paymentmodule (non-fast-forward) error: failed push refs 'https://********@bitbucket.org/********/myproject.git' hint: updates rejected because tip of current branch behind hint: remote counterpart. integrate remote changes (e.g. hint: 'git pull ...') before pushing again. hint: see 'note fast-forwards' in 'git push --help' details.  //this step mistake c:\users\***\documents\myproject>git fetch origin paymentmodule password 'https://********@bitbucket.org': https://bitbucket.org/***********/myproject  * branch            paymentmodule -> fetch_head  //this wanted did without reverting previous step c:\users\***\documents\myproject>git fetch origin paymentmodule:tmp password 'https://**********@bitbucket.org': https://bitbucket.org/*******/myproject  * [new branch]      paymentmodule -> tmp  c:\users\***\documents\myproject>git rebase tmp first, rewinding head replay work on top of it... warning: unable access 'www/templates/messages/.gitattributes': permission denied warning: unable access 'www/templates/messages/.gitattributes': permission denied warning: unable access 'www/templates/messages/.gitattributes': permission denied warning: unable access 'www/templates/messages/.gitattributes': permission denied applying: implement chat services warning: unable access 'www/templates/messages/.gitattributes': permission denied using index info reconstruct base tree... .git/rebase-apply/patch:63: trailing whitespace. instructions on this, start .git/rebase-apply/patch:586: trailing whitespace. # .git/rebase-apply/patch:588: trailing whitespace. # .git/rebase-apply/patch:613: trailing whitespace.  .git/rebase-apply/patch:759: trailing whitespace.  warning: unable access 'www/templates/messages/.gitattributes': permission denied warning: squelched 348 whitespace errors warning: 353 lines add whitespace errors. falling patching base , 3-way merge... error: cannot stat 'www/templates/messages': permission denied error: failed merge in changes. patch failed @ 0001 implement chat services copy of patch failed found in: .git/rebase-apply/patch  when have resolved problem, run "git rebase --continue". if prefer skip patch, run "git rebase --skip" instead. check out original branch , stop rebasing, run "git rebase --abort".  //this mistake c:\users\***\documents\myproject>git rebase --skip  c:\users\***\documents\myproject>git rebase --abort no rebase in progress? 

edit:

i ran 1 more command following output. not sure means

c:\users\***\documents\myproject>git fsck --no-reflog checking object directories: 100% (256/256), done. dangling blob 8860babe2931ea1e9dbafaa589e7c4feb19f14c7 dangling commit 1da3053dbe12d11e4ae65dc3a2ba720c9b272b7b dangling commit cd03cd391e3447be272d3b8307ddb49cd3de1189 dangling blob c9648cae0b45ef174fa88aa5ad6b9008085a9766 dangling blob 2bc76e285d27d6979cf47148711e7c91379910c8 dangling blob 410f4c2f02192a56a9d4c0f01e847d85276799b4 dangling commit 60b1d2f1e2b7f8bfa42d4d2f49857a1b66db8575 dangling blob 949297fe49f427065fe0e74568af852e2796cc19 dangling commit 50d44e0896b10d461629fc5bffe60ee26996d433 dangling commit a8d4aa02b375cb3e04b90033a1a9d17697f6583d dangling commit f5b5c1a66f450010f30c352caa3baa2f5a3b6576 dangling blob 5af70169556610abe956f748dc25af77494cc06e dangling blob 981d6a55406d8b2ec63f0952ac65ad1afc893d8a dangling commit d61db3516d2bbaf24efcf3fe9b644823bdc4a7ff 

do have write entire code again!?

after long discussion in chat, turns out earlier commit (with log message "implement chat services" still visible in reflog. (you had said in question wasn't, missed seeing it). need (and have done, know chat) is:

git reflog 

about ten lines down in reflog, you'll see "a8d4aa0 head@{12}: commit: implement chat services". commit hash needed a8d4aa0. can do:

git checkout -b new-branch-name a8d4aa0 

now commit safe on new branch, , ready merged or rebased needed.

by way, findable via git fsck --no-reflog; gave when said "unfortunately these commits old commits think craeted way before ones lost". here's line git fsck --no-reflog output posted:

dangling commit a8d4aa02b375cb3e04b90033a1a9d17697f6583d 

if had run git show a8d4aa02b375cb3e04b90033a1a9d17697f6583d, have found commit.

lesson: when looking lost commits, never give up. never surrender. (thanks, galaxy quest!)


Comments

Popular posts from this blog

sublimetext3 - what keyboard shortcut is to comment/uncomment for this script tag in sublime -

java - No use of nillable="0" in SOAP Webservice -

ubuntu - Laravel 5.2 quickstart guide gives Not Found Error -