简体   繁体   中英

best way to remove a committed fie from remote after push

So long story short. I made a lot of changes to a project ( more than 85 files) and commit and push it to remote(bitbucket), and did 2 more commits after that, now my colleague ask me to not include the yarn.lock and package-lock.json files.
what i did was just normal:

git add .
git commit -m " message"
git push origin myBranch

to push to the remote, and it's only me working on this branch. now my question is, How can I exclude them?
I have found this answer: Git: Remove committed file after push but it makes me more confused

When you added new files you did git add and then committed them. You can do the equivalent thing to remove them. So run git rm and the git commit -m "message". Then when you push to git, the specified files will be removed.

In order that these files are then not included in git add in the future you can add them to a.gitignore file. All files in.gitignore are not added to git.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM