Git not working

So, I have a commit branch that I want to return. So I type git revert <commit-hash>

But when it starts, it says:

 $ git revert 165702b305 On branch develop nothing to commit, working directory clean 

This commit was tracked because the culprit of the error and identifier wanted to return it, but for some reason it does not work. Can it be spoiled? Other answers and searches could not help.

+14
git git-commit undo
source share
5 answers

Had the same problem using:

 git revert --no-commit <commit-id> -n HEAD 

Worked for me

+1
source share

I had exactly the same problem and the syntax below worked for me:

 git revert -n master~5..master~2 
-one
source share

This worked for me:

 git reset HEAD^ 

This way, I can go back to the point before committing and saving all the changes so that I can easily modify only part of the code.

I can also execute this command several times to move multiple commits in the past and save all changes.

It works for you to make your local repository. If you have already pushed (uploaded) your commits to the server, you will have to find another way.

-one
source share

The next git command will be more specific. It will indicate that the return will begin with the HEAD pointer (where the branch is now) and end with commit 165702b305:

 git revert 165702b305..HEAD 
-one
source share

I had the same problem, and as a result, I took a chance manually. I think the problem is related to other commits. I tried to return more than once, and I committed during my reversals, and then stopped working

I suggest trying:

 git revert --no-commit <commit-id> -n HEAD 
-3
source share

All Articles