Reputation: 1759
I created a commit that includes changes to several files, which are ok, except for one. This file was already in Github and my PC but I wasn't supposed to change it in GitHub (only in my PC if I needed to do so). So when I was creating a pull request, in the previous step where it shows you the changes, it shows the changes.
I tried to fix this with git revert -n [hash of the commit] but it reverts everything and I just need this file to not show up as changed in the GitHub pull request.
Upvotes: 0
Views: 1007
Reputation: 547
Possbile Solution: You should use reset command of git.
Please follow the below steps:
Upvotes: 1
Reputation: 1256
To revert one file from a commit:
<on your branch>
git revert -n [hash of the commit]
git reset -- <list of files you don't want to revert>
git commit
git push
The git reset <file>
command removes or resets files in the staging area so that they will not be committed.
Another way to revert a single file is:
<on your branch>
git checkout [hash of the commit]:[filename]
git add [filename]
git commit
git push
Once you've pushed your changes onto your remote, Github branch, your pull request will be updated.
Upvotes: 0