Issues with yarn.lock file changes

I don't know why but whenever I want to push some code changes in specific file to github using git add filename and check tracked files using git status it shows the filename mentioned but when pushing it on Github it also shows other files specifically like yarn.lock etc. What is the reason. If anyone has any suggestions please help. Thank you for reading!
No description
No description
No description
No description
4 Replies
MagerX
MagerX9mo ago
Where exactly are you checking for the change in the data? Is it possible youre looking at the wrong branch? Your steps appear right as far as I can tell. Yarn.lock is a file that generates when you run yarn install. Essentially its a file of the exact versions that were installed into the project from npm. npm allows libraries to define open ended version requirements, something applications typically prefer not to do. yarn.lock provides a potential layer of security if needed and essentially shows you the state of the project from the perspective of your package manager.
vivekjaiswal4077
vivekjaiswal4077OP9mo ago
Suppose I have changed 1 file sidebar.tsx that fixes a github issue so i want to push this specific file to the remote repo. For that i follow steps: 1. I create a new branch (lets say sidenav-removal)from the main branch for and change the code that solves the issue 2. git add sidebar.tsx 3. git status to check if only the specific fiel is tracked 4. It shows the only specific file in green which i want to add/track 5. I commit it using git commit -m "some message" 5. I then push it to the same branch i created using git push origin sidenav-removal 6. after that when i go to my github page to raise a PR I click on the compare and create pr. But here when i click that button hoping to see only the sidebar.tsx file which i pushed, I see yarn.lock file as well which is increasing the size of the PR and aslo creating merge conflicts. At first in the main branch I mistakenly ran the project using npm but It supposed to be run using yarn that generated package-lock.json file which I deleted when I set up the project again with yarn and installed all the dependencies using yarn which modified the yarn.lock file after that every branch I make from the main and push code changes it includes those yar.lock files adding yarn.lock file to the .gitignore file is also not working and now pushing both files as modified files .gitignore and yarn.lock Please help
MagerX
MagerX9mo ago
You need to force merge the yarn.lock file. You do not want to corrupt that file, so just force push the entire file. There are no conflicts in yarn.lock that will create issues, and if you do run into an issue with yarn.lock, delete the file and run npm install and it will regenerate.
vivekjaiswal4077
vivekjaiswal4077OP9mo ago
Okay
Want results from more Discord servers?
Add your server