Hi in this post we are going to learn how to find a change that we made and we lost while we coding.
The other day I was coding then my App was working perfectly but at some point I did a change then I commit and push a change to Github then I continued coding but at some point my app doesn’t worked as was, so in this case I will let you know how I solve the issue.
Let’s suppose that this is my App and is working as I expected:
Then I commit and push multiple changes to Github and now my App looks like:
Where at some point I damage the styles of the App.
So in this case the first step that you need to follow is: Go to your commits section on your Github project:
Then here if you see we have all the commits that we made and also the name of the commits, in this case is represented by numbers (at the end is a string of numbers):
Cool, next step is go to your terminal and check commit by commit where your App was working as you had it.
So, copy your first commit (from top to a bottom) and let’s see in which commit the App was working:
The commit is a string of numbers like this:
Then go to your terminal and paste that commit number with “git checkout 4d995b1688575ca048c9173fc5e366cba64184ef“
Now you are inside of that commit and you can see the changes in that commit:
Then run your App and see if in this commit the App was working:
Then the App looks like: so no, this is not the commit where the App was working correctly
So let’s copy the next commit and follow the same pattern to check if in the next commit the App was working:
Run the App:
Nice, so looks like in this commit the App was working, so the issue is in the above commit (4d995b1688575ca048c9173fc5e366cba64184ef) here open the commit and check what code break your App:
In my case I removed the class so that cause the issue in my App, at this point I can revert this change and done!
By Cristina Rojas.