I have not used Git extensively and so I usually end up searching for my answers to my Git questions online without much trouble. However yesterday I encountered a problem I haven't faced before and wasn't sure the correct Git way to go about it when searching online. Here's the problem I faced:
- I committed some code that was not fully complete
- My manager committed other changes not related to my code after my commit
- Then he reverted my commit so my changes were no longer on master
Here in lies my problem, I need to grab my commit, make some changes and then re-commit them. My question is this, what is the proper way to grab my commit changes that were reverted, edit them and then re-commit them?
What I did: I solved my issue by pulling from master to get up to date, then went to the Bitbucket server and selected my commit, downloaded the files and copied those files back into the project. Then I proceeded to make changes. This allowed me to do git status and see those files were changed and also use git difftool to compare my changes with master before committing to ensure I want the changes I am committing.
I tried checking out the commit but then the files didn't end up showing up as modified and wasn't sure where to go from there... Was I supposed to branch from the commit, make changes on that branch and then merge it back into master?