My gitignore file looks like this:
# Ignore bundler config.
/.bundle
# Ignore all logfiles and tempfiles.
/log/*
!/log/.keep
/tmp
coverage/
public/system/
.DS_Store
.env
logfile
development.log
For whatever reason I keep ending up with my development.log file present in my commits and in pull requests. Right now I have an open pull request with the full development.log file present. How do I remove it?
I've tried the following:
End up with The current branch resource has no upstream branch. To push the current branch set the remote as upstream, use git push --set-upstream origin resource. I do that and then I check my PR and the file is still there because clearly it's a no-edit.
I've also tried
The problem here is that the file is present locally, and should be, but I want it stripped from the PR.
How do I remove a file from a pull request but not remove it locally?
First remove the log file from the git index while leaving it on disk with the --cached option:
git rm --cached log/development.log
Then check in the file removal:
git commit -m 'remove development log'
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