When I try to stage individual hunks or lines of code from a file, they appear to be staged correctly and the rest of the file remains unstaged. However, after I submit my commit, the entire file is committed.
I've noticed this happening a little prior to March 18th. I suspect it might only be happening in JS files, but I haven't 100% confirmed this to be the case yet.
Has anyone else encountered this issue?
Hey @jordangehman , welcome to the Community!
I haven't seen other mentions of this issue yet but would love to try and reproduce it. What OS and version of Sourcetree are you on? It also sounds odd that it would be restricted to a particular filetype (it's all text to git/sourcetree), but what other languages or filetypes besides javascript do you typically work with?
Thanks,
Daniel
Thanks Daniel! I agree this seems like an odd issue I've encountered.
I'm on MacOS Big Sur 11.2.3 using Sourcetree version 4.1.0.
I also work in a lot of PHP and SCSS files. I will try to reproduce it soon and get back to you.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
@Daniel Eads I have confirmed I can only reproduce this in one specific React project, and it only happens when making commits from `.js` files. What information would be helpful for me to share to help identify the issue?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
@Daniel Eads I got some more information from a coworker. This particular React project has a pre-commit hook installed via Husky. As part of committing, it runs lint and prettier. From the `package.json` file:
"husky": { "hooks": { "pre-commit": "lint-staged" } }, "lint-staged": { "*.{js,json,jsx,css,md}": [ "prettier --write", "git add" ] },
It seems likely that this is the culprit; there is probably a conflict with this and SourceTree that causes the app to commit the entire file.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Great, thanks for the additional context! I've tapped the Sourcetree development team for their insights here and hope to have something for you shortly.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi @jordangehman ,
We are currently looking into this issue and we hope we can come up with a fix soon.
We will update here once we figure out that.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.