SourceTree can't see current file contents

I ran an initial commit of all of my code on 29th January. I've been working on the code on and off and wanted to check in the changes. When I go into my repository in SourceTree all of the files show up in Files in the working tree with + symbols indicating that they are new files. Selecting any of them shows the entire contents of the file from when I checked the files in in January. I've checked the bitbucket website and the files were definitely correctly checked in on the intial checkin. When I try and commit there are no files showing up because SourceTree has decided that nothing has changed.

I haven't used source control a great deal and have run into significant problems with it in the past (including wiping out 2 months worth of work on one occasion) so I don't know how to proceed.

2 answers

1 accepted

You should be able to re-copy the directory with your latest changes into the git-controlled working copy without any issue. Just make sure that the directory where you made your changes does NOT have a hidden .git directory, as that would overwrite your repository, not just your working copy.

Egads! It turns out SourceTree decided to duplicate the entire project into an (almost) identical file path. Hence there were no changes to the files because I wasn't 'working' on the files... This is going to get messy...

SourceTree has no capability to do this unless you manually clone within SourceTree itself. There's no copy functionality, and clones are only done through the clone dialog unless you pull down a subtree/submodule (which is also a manual operation)

Source: SourceTree developer (me) ;)

I THINK that what happened was:

When I was creating the repository I tried to connect it directly to my original source code root folder

SourceTree told me it couldn't clone to a non-empty folder

I cloned to a slightly differently named folder and then copied the files across to check them in (leaving it uploading for quite a while)

When I returned to my code a few days later I COMPLETELY forgot to work in the new working folder and continued working in the original folder (which wasn't being tracked by SourceTree)

What I can't understand is why I couldn't nominate a non-empty folder as my working folder when my bitbucket repository had no files in it at all? I can understand there would be a problem if there was existing code in the repository but surely I should be able to say 'here you go empty repository, this is my working folder I've been using up until I decided to put the code under source control'???

Suggest an answer

Log in or Sign up to answer
Atlassian Community Anniversary

Happy Anniversary, Atlassian Community!

This community is celebrating its one-year anniversary and Atlassian co-founder Mike Cannon-Brookes has all the feels.

Read more
Community showcase
Brian Ganninger
Published Jan 23, 2018 in Sourcetree

Tip from the team: workflow and keyboard shortcuts

Supported Platforms macOS Sourcetree has a lot to offer and, like many developer tools, finding and using it all can be a challenge, especially for a new user. Everyone might not love ...

647 views 0 4
Read article

Atlassian User Groups

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

Find a group

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

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you