My Revert doesnt work

So just before making the new scripts for triggering i saved my commit and went to change the name of my scripts. i messed it up and my game messed up so i just thought ez. Ill just reverse to what i saved before doing this like before with my terrain.

Is there any reason my [Organizing/Trigger] branch isnt the top one in my branch after hard reversing?? ive done this before but its not working now

so im looking at my game and it reversed everything like i expected besides the very thing i wanted to be reserved and that was the code. when i load up my game i have 2 different codes for how my ship is controlled yet there shouldnt be because when i saved it i hadent typed in anycode i was on the box collider part of the video. This is kind of embarassing because its probably the 3rd time ive had a problem tryig to use source tree but im 100% sure that when i go to my source tree and go to the [Reset current branch to this commit] and use HARD the [uncommited changes] dissapear and the one you reset it to shows up in sourcetree as your first branch

Hi Jayy,

Did you close Unity before you reverted your project to an earlier commit?

I think i didnt. so should i revert it to the one before that. The [obstacle/Enemy] branch. either my unity or script was open because now i have duplicates when i open unity

This sounds as though something went wrong. Close Unity and VS. The try to revert your project to the desired commit again.

I did that but some of my things didnt change like the script and my ships prefab other than that everything changed and ik it was reserved because i called my cubes obstacles before reverting and they went back to cube. Should i try reverting to one farther back since maybe i messed up the latest one?

Before you do anything, make a backup of your project folder by duplicating it.

Then test one of your ealier commits. It might be that some of your changes had not been committed when you made a commit in the past. Or you thought you made a commit.

If you just want to discard uncommitted changes, go back to the uncommitted changes and click on the Discard button.

i tried discarding the uncommited changes but nothign happened they stayed there.

And as far as reversing goes i duplicate this project? And then try reversing to an older commit

Duplicate your project folder in the Windows Explorer to create a backup of it. Git can destroy your project if you do something wrong.

In the first screenshot, there is a tab named “Reset All”. Click on that.

oh ok. Just to make double sure tho i duplicate my project folder name it like 4_Astral_assasin_duplicate. Then i make a Git of it on source tree to save it then on my main one i try reset all and in case of anything my duplicate with its own sourcetree is there correct?

Save the folder on an USB stick or wherever you want. Do not touch this folder. It is a backup.

Continue with your actual project, try what you wanted to try in SourceTree. IF the project breaks, you can delete this folder and duplicate the duplicated one.

alright so heres my understanding on what im about to do.

  1. First im going to make a copy of this folder here


Ive never used a USB so ill just save it in another folder after copying it.

  1. After putting that copy of my game in another folder i go to my original game with the sourcetree and hit Reset all.

  1. IF it breaks i delete the game and then use my copy?

And another thing is considering that doing reset all would remove my uncommited my changes it seems like the proposed branch i want to reset it to is messed up because i never closed the scripts or game when i did it So would an alternative be Resetting a current branch to my Obstacles an Enemies Commit?
Im sorry for the trouble im just really trying to understand/learn while making sure im doing the right thing.

If something breaks your project, restore the copy. “Reset All” just removes your uncommited changes. This should not break anything. However, in your first post you wrote that you wanted to use HARD, which is a bit dangerous as Ben mentioned in the video.

If your commit is messy, Git cannot magically tidy it up.

im just really trying to understand/learn while making sure im doing the right thing.

That’s absolutely fine. I asked you to make a backup of your project so you can test everything without the risk of losing your work. I’m not saying that you will break your project. I’m just saying: Better safe than sorry.

1 Like

Alright i ended up Hard reversing and it looks good. Thanks alot again.

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.

Privacy & Terms