I accidentally committed and pushed my changes and also node_modules
into a remote branch.
So, to fix, I tried rebase by doing: (Don't mind if I didn't include in the steps adding node_modules into gitignore since I did it in separate process)
- git log
- git reset "to the commit that includes the node_modules"
- git add "only the files that needed to be committed and pushed"
- git status (node_modules are now unstaged)
- git commit -m "remove node_modules"
- git push -f
Now its working as expected (to commit and push my changes), if I pull request, it says no conflict with master.
But I'm curious as to how merge works, does it also merge the commit which includes node_modules, or will it just merge the latest commit ?
Because my goal is to only merge to master the newest commit that excludes the node_modules and ignore the commit that includes the node_modules