proggR Posted August 31, 2011 Share Posted August 31, 2011 Apparently I made a commit a while back that included some vital login information that shouldn't have been committed. Obviously the username and password are in the process of being changed but I still need to remove that change from the history. I have the commit numbers but how can I delete the changes to the history without affecting the rest of of the commits? The file in question was included in a commit that also changed another file. Those changes I would like to keep, just not the changes to the settings file. I've been searching for an answer but I'm not overly familiar with git except what I use in my day to day development. Any help or guidance would be appreciated. thanks in advance. Quote Link to comment Share on other sites More sharing options...
salathe Posted August 31, 2011 Share Posted August 31, 2011 If the commit has only ever existed locally, then you're in luck. If the commit was pushed anywhere (anywhere!) then, depending on where the commit may have spread to, life could be painful. So, before offering solutions, exactly where is the commit now? Just in your local git repo, pushed to a super-tightly-controlled remote, only wherever your colleagues (if there are any) might have it, or potentially anywhere? Quote Link to comment Share on other sites More sharing options...
proggR Posted August 31, 2011 Author Share Posted August 31, 2011 Its been pushed to a remote repository where only my colleagues have write access to. It is possible for anyone to clone it with read only access, but only we have access to write to it. This mistake was made almost a month ago and there are tons of commits that have been pushed to the repo since then by both me and my colleagues. I've been reading about rebase but I don't really understand it well enough to find a fix. One fix I've come across is to checkout a new branch based on the bad commit, remove the file that's bad, checkout the main branch and rebase from the new branch. I've tried this just not but it seems to come into a lot of conflicts that I don't understand why they would exist. Also, I don't want to delete the file, I just want to undo the changes that were made to it during that commit. I hope this helps. The developer that usually takes care of anything git related is in the middle of preparing for an update and doesn't have time to sort this out and since its my fault I've been tasked with the cleanup. Thanks again. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.