Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in
Deleted user
0 / 0 points
Next:
badges earned

Your Points Tracker
Challenges
Leaderboard
  • Global
  • Feed

Badge for your thoughts?

You're enrolled in our new beta rewards program. Join our group to get the inside scoop and share your feedback.

Join group
Recognition
Give the gift of kudos
You have 0 kudos available to give
Who do you want to recognize?
Why do you want to recognize them?
Kudos
Great job appreciating your peers!
Check back soon to give more kudos.

Past Kudos Given
No kudos given
You haven't given any kudos yet. Share the love above and you'll see it here.

It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

Unable to stage hunks or lines of code in JS files

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?

1 answer

0 votes
Daniel Eads Atlassian Team Apr 19, 2021

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.

@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?

@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.

Daniel Eads Atlassian Team Apr 26, 2021

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.

Like jordangehman likes this
Alan Francis Atlassian Team May 10, 2021

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.

Suggest an answer

Log in or Sign up to answer
TAGS
Community showcase
Published in Sourcetree

Tip from the team: configure your repos for hosting goodness!

Supported Platforms macOS Windows We recently introduced support for additional hosting services such as GitHub Enterprise, GitLab (Cloud, Community Edition, Enterprise Edition), and...

3,419 views 4 5
Read article

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you