Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

how to cancel revert?

이이담
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
August 14, 2023

I'm in charge of sound design, but not an expert with git.
I used Sourcetree for data sharing with the developer because he suggested it.
Today, one of my files is significantly more than 100mb, so it stuck to commit.
The developer said, "you need to revert it," and I did it.
And my work was gone.
How to cancel or reset "revert"?
I tried the reflog method, but it isn't work.

1 answer

0 votes
Patrik S
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
August 15, 2023

Hello @이이담 and welcome to the Community!

In git there are different ways to revert a commit :

  • Using the git revert command that will create a new commit that undoes only the changes introduced by the commit being reverted. 
  • Using git reset will move the ref pointer of HEAD and the current branch to the provided commit, meaning that it will remove the changes of all of the commits that occurred after the target commit.

You can find more details about the difference between revert and reset in the articles Git Revert and Git Reset.

From your description, it seems like you did the revert from Sourcetree, which uses the git revert method.

In this case, a new commit (the "revert" commit) should have been create when you first reverted the changes. You should be able to select the same Reverse option on that "revert" commit to undo the changes, by right-clicking on the commit and selecting the Reverse option : 

Screenshot 2023-08-15 at 5.15.56 PM.png

This would create a new commit that should bring back the files/changes prior to the first revert.

Let me know in case you have any questions.

Thank you, @이이담 !

Patrik S

edamlee
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
August 16, 2023

Thanks for your kindness :) 

I had have already tried your method, but it didn't work. 

maybe my old commit made me stuck into error. 

So I found the another way with my friend who knows about sourcetree well.  

In my case, I tried 3 ways

2) reset --soft HEAD{0} for cancel revert,

3) reset the master branch. 

4) and git restore --staged . 

Like Patrik S likes this

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
TAGS
AUG Leaders

Atlassian Community Events