On Thu, Sep 27, 2018 at 11:13:19AM -0700, mondino.m...@gmail.com wrote:
> I tried to commit my git repo on a subversion system and something went 
> wrong. Here in detail what I've done so far: 
> 
>  1. starting from a commit on our svn, I launched this command: 
>     `$git svn clone my_repo_url -s `
>  2. worked on my code (so I've made my stuff);
>  3. when all was ok I rebased everything. Since I read that svn doesn't 
> work very well with branches;
>  4. So, with a single branch (master), I ran this command: `git svn dcommit`
>  5. The push onto svn server failed (probably some conflicts to resolve). I 
> didn't want to solve those at that moment so I launched this command: `git 
> rebase --abort` (maybe I didn't read very well what it does, but git was 
> suggesting this);
>  6. Right now I have lost my solution (.sln file) and on a project I can 
> see a folder called 'Backup' (with all my classes duplicated)... wtf
> 
> The simple question is: what is happening? How can I restore my solution 
> before to the 'git svn dcommit'?
> 
> Here the output of my .git/logs/HEAD:
> 
>     5edc59acb6e200aef991d7de124008f8120ee187 
> 1234c77ff6a21551ea615bee11cd9c56f2beb839 my_name my_email 1538033064 +0200  
[...]

I'd roll like this:

  $ git rev-list --no-walk --reflog | while read c; do
      git ls-tree -r --name-only "$c" | grep -qF .sln || continue;
      echo "$c"; break;
    done

This encantation will loop over all the commits kept in the reflog (the
place where Git records all "drastic movements of branch heads"),
and for each it will dump the list of files which constitute that commit,
and then try to find the string ".sln" in those filenames
(You might drop the `break` and it will list all commits containing ".sln".)

Once you've found that commit (its SHA-1 name will be printed), turn it
into a branch or a tag - say, by running

  $ git branch whatever <that_sha1_name>

and then inspect what's in that branch.

This obviously does not solve the issue with interacting with Subversion
but at least you'll be able to recover your work.


(Just in case, the shell encantation above implies you have a
sh-compatible shell such as bash or dash. Windows' cmd.exe won't cut
this script.)

-- 
You received this message because you are subscribed to the Google Groups "Git 
for human beings" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to git-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to