I created a new Bitbucket repository today, clone the repository locally, copied an entire website to the cloned repository and then did a commit and push to origin master.
The commit was quite large and took a while to finish, the push took over an hour because of the number of files.
I used SourceTree for all this and SourceTree has removed the checked in files from the list of files that have been staged or need to be staged. I guess that means SourceTree thinks the files have been committed and uploaded to BitBucket. SourceTree also shouws the number 12120 next to the repository name which is about the right number of files.
But when I open the repository in Bitbucket it has no files listed and nothing was committed.
What is going on? Where are my files? Are they committed or not?
Thanks for any help
Thanks for answering Seth!
I checked Bitbucket this morning and it looks like all the files are there now. My commits were logged 19 hours ago, according to BitBucket. Maybe it just took a while to get everything uploaded because there were so many?
SourceTree has changed the isting of the repository too. They now show a - sign with the number 12120 then a ? and the number 1 next to the master branch for the repository, It looks something like this:
- 12120 ? 1 master
Sorry, but I don't know how to take a screen shot on my laptop. I hope this is enough to explain what I see.
I have another question as well, about ignoring files. I want to ignore .pdf files in this repository. What do I add to the .gitignore file to make that happen? And is there an easy way to remove those pdf files once they are checked in, other than removing them from my working copy and committing changes.
Thanks again Seth
You can ignore pdf files by putting
in a .gitignore file. Note however that ignoring files just causes git and SourceTree to stop reporting files as untracked. It does not affect files that have already been added to the repository. You can remove those files using
git rm --cached
The --cached flag makes it so that the files are removed from the repo but not deleted from the working directory.
However this only removes the files from the repo on subsequent commits. It does not remove them from previous commits. There is not an "easy" way to do that, although it can be done. You can find info on that by googling, but this is a good resource:
I'm in agreement with Seth, though, that your other question, if there's any part of it still unanswered, would be easier to address with some screenshots. I'd encourage you to take the time to google how to take a screenshot (I could tell you for Mac off the top of my head, for Windows, I think it involves the print-screen button but I forget the specifics)
First let me thank both of you for your help and patience. I really appreciate that.
Before I show the screen shot, I should tell you that I ran a commit and push late last night and left it running over night. This morning SourceTree showed an error message saying it lost the server connection. I had forgotten to change the settings that put the system to sleep if it has been idle for a certain amount of time. So after a couple hours of getting n input, my laptop went to sleep and SourceTree could not finish the task.
Here is the screen shot:
I suspect the - 12120 mean that's how many files still need to be pushed but they are staged.
BTW, the files shown as staged are the PDF files I don't want in the repo anyway.
I also found the documentation for removing files from the repository, including the history of the files. There is a Java tool available that the documentation recommends over using the git commands. Its called BFG and is supposed to be easier to use and faster than using git filter-branch.
I am considering my options right now, and I am wondering what happens if I just delete the entire repository and start from scratch, this time with the correct .gitignore file (thanks Tim!) so the PDF files are not checked in in the first place. That should speed up the commit and push enough so I wouldn't have to worry about time outs due to long idle times.
BUT, if I remove the repository, will the files truly be deleted?
Can a deleted repository be restored?
Is there a way to permanently delete a repository?
Can I create a new repository using the same name, once I delete the current repository?
Thanks again Seth and Tim
When you talk about deleting a repository, it's important to distinguish between deleting your local repository and your remote repository.
A local repository is just a folder, it can be deleted and restored the same way you would delete or restore any other files on your local computer.
For the remote repository, it depends on what you are using remotely. If you delete a remote repo, the files will be deleted and you should be able to create a new one with the same name, yes. You might want to fork the existing repo first, just for safety. Whether you can restore a deleted remote repo will depend on whether you're on Bitbucket Cloud or Bitbucket Server or perhaps some other remote host.
Of course you are correct Tim, I should have been more specific.
I was talking about deleting the remote repository because it has a bunch of files I really don't want to store remotely.
And I am using BitBucket cloud. So:
Could a remote repository on BitBucket cloud be restored once it has been deleted?
I'm not sure. I use Bitbucket Server (aka Stash until just recently) which is similar but not identical. I'd lean towards doubting there's a way to restore a deleted repo. What you could do is fork the repo under a new name first, then delete the original and proceed to recreate it, keeping the fork around until you're sure everything has gone smoothly. Or just keep a copy of the local repo somewhere for the same purpose.
I wondering why it thinks the pdf files have been deleted? They are still in the local copy and I have not done anything to remove them from the remote repository.
I am leaning more and more towards starting fresh. It may take a while, but at least I'll have a clean start.
I will start a new question about deleting and restoring a repository when using BitBucket Cloud.
Thanks Seth and Time. You have both been a great help to me!
I am not worried about the local copy. I got the files in 2 locations. I just want to be sure that the repository is really gone, including history and all that, once I delete it.
I started a new question for that. Hopefully someone will see it and reply, now that this question is not hidden in a post with totally different topic.
Again thanks for your help, Tim.
This community is celebrating its one-year anniversary and Atlassian co-founder Mike Cannon-Brookes has all the feels.Read more
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 ...
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!
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