Take for example the following scenario:
.gitignore
before git add
A - B - C - D - E
| | | |
| \ | /
| commits that accidentally track application config
|
commit to untrack & .gitignore config
[finally you did the right thing... but too late?]
If you ever reset or cherry-pick back to C, D, or E, it'll overwrite the config file.
Is there anyway to rewrite C - E by applying the B commit on them?
If the config file should just be untracked, better make a commit over E untracking the config file, adding it to gitignore etc. If the config has sensitive information, in which case it must be removed from any commit of the repo, you have no other go but modifying history ( This help page from GitHub talks about how you can do this - http://help.github.com/remove-sensitive-data/ )
Due to the very nature and requirements of Git, you cannot make a change to a commit and make it seem to be the same commit.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With