Welcome to the CSC Q&A, on our server named in honor of Ada Lovelace. Write great code! Get help and give help!
It is our choices... that show what we truly are, far more than our abilities.

Categories

+18 votes
asked in CSC305 Fall 2022 by (1 point)

2 Answers

+10 votes
 
Best answer

One approach is to use GitHub, click on the history next to the number of commits, and click on a specific commit, and then click the browse button to browse the files that were in the repository at that point in time. Then you could copy code down from the website and paste it into your Eclipse.

Another approach would be in Eclipse to right click on a file and do "Compare with" previous revision, and when you find the version you're looking for, you could right click and do "Replace with" that version.

If you really want to undo a specific commit and the exact set of changes in that commit, then you can use the git revert command from the command line, and you specify the long unique identifier (e.g. ed2f64...) for the commit you want to undo.

answered by (508 points)
selected by
+5

P.S. Do NOT use git reset unless you are sure you know what you are doing, since you or your team could lose work permanently that way...

+10 votes

I don't know if there is a dedicated revert button, but by clicking on the file and clicking history you can view the older versions, and then build off those or maybe just commit an old version. There could be a better way though, I am not 100% sure.

answered by (3.3k points)
...