views:

51

answers:

1

To update my multiple repos, I did:

git bulk fetch origin
git bulk pull origin master

Now it appears that some of the functionality which was working initially is not working now and so I want to revert back to previous state of my repos.

How can this be done ?

I tried doing git reset --soft commit id & git reset --hard commit id for one repos but it is not working.

Any suggestions.

A: 

You can use git reflog to revert your repo to your old state.

You should see something along the lines of:

git reflog
bb3139b... HEAD@{0}: pull : Fast forward
01b34fa... HEAD@{1}: clone: from ...name..

Use a git reset --hard to reset the repo to the SHA1 read from the git reflog.


Note: Another way, instead of using git-reflog and copying SHA1 reference, is to use a revision specification: master@{1}, which is the previous position of master, master@{"5 minutes ago"}, or master@{17:30}.

VonC
`fatal: Not a git repository (or any of the parent directories): .git` tried using in the directory where I have all my repos and am getting this error.
Rachel
@Rachel: that is a command for *one* Git repo: you must be within that repo to run it.
VonC
Can you provide an example of second type ?
Rachel
Yes I got that point.
Rachel
@Rachel: what is that `git bulk` command you use in your question? a script which execute a git command in all subdirectories?
VonC
yes. this command would run through all the subclasses and execute for each sub directory.
Rachel
@Rachel: If you're really, really confident that all of the repos pulled something, you could do something like `git bulk reset --hard HEAD@{1}`, but if there's a repo which didn't pull any changes, that will not do what you want. It's going to be best for you to examine them one-by-one and make sure you're performing the reset you want.
Jefromi
Is there any way I have time information as to when the particular repo was modified and what files in there were modified with the modifications. I am sure that there has to be way to do this but just not sure of how this can be achieved.
Rachel
@Jefromi: Yes. Actually right now am just doing it that way to get the information for each and every repo.
Rachel
@Rachel: You can use `git log -g --name-status` to see the same thing as reflog, except with the full log information for each of the commits the reflog is pointing to. (`--name-status` gives you the names of all files it touched, with a flag to indicate whether they were added, deleted, modified, or renamed)
Jefromi