I'm using Sourcetree to track text files in a large project. There are a significant number of non-text files in the project that are not being tracked which we backup regularly. I am generally confused by the git terminology and am hoping I'm missing something.
I was pushing a change to the repository when my computer crashed. Coming back to sourcetree found no Log/History and all files were listed as changed. What I'd really like to do is to restore the log history to source tree. Looking at the various files in the .git folder nothing looks particularly amiss and I'm wondering whether I'm somehow just located on the wrong commit or otherwise disoriented. Alternatively I'd like to be able to reclone or restore the master from bit bucket but I keep getting messages along the lines of "the large number of untracked files will be deleted". Is there a way to get a refreshed repository without disrupting untracked files
I wouldn't have expected a git push to have corrupted your repository, but anything is possible. Additionally if the repository was corrupt I don't believe Sourcetree would open it.
However as Sourcetree simply runs/interprets the Git executable it might be worth taking Sourcetree out of the mix when checking the state of the repository. If open the Terminal for the repository in Sourcetree and run:
You should see the first few lines of the git log listed, alternatively if the repository has been corrupted you should see a git error.
You can also use
To give you a history of what has happened to your repository
Thank you for leading me down the right path.
running git log resulted in the following error
>fatal: your current branch appears to be broken
Looking up that error message I found that the \refs\heads\master file sometimes gets corrupted. So I cloned the repository to a new folder and then copied the master file over to the old folder and everything is returned to normal.
To clarify, the crash was a computer issue not a sourcetree issue. Sourcetree just lost it's way as a result. All is well in the end.
Supported Platforms macOS Windows We recently introduced support for additional hosting services such as GitHub Enterprise, GitLab (Cloud, Community Edition, Enterprise Edition), and...
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