Hi. I've been trying to checkout files, but so far it's not working. When I do a checkout, my local files are not changed. I screwed my code up and need to get the previous commit.
I'm sure that it's something really basic. If it helps, I'm using SourceTree.
Are you getting any kind of an error message? Make absolutely sure that you're looking at the same directory that SourceTree is working on - sometimes it's possible to have two clones on your local system without realizing it. Try clicking on the terminal icon and typing "pwd" to make sure that SourceTree is looking at the directory you think it's looking at. Otherwise maybe post some screenshots to help us better determine what might be going wrong.
Hi Tim, I used the "pwd" command and it does point to the right place. I tried doing a checkout again and the image I've included came up. It asked if I wanted to "Disregard Changes"? I select yes. I don't think all my files came through though. I may be wrong, but It seems like my code isn't entirely the same since I made the commit.
Any help appreciated... even if you tell me I'm crazy
Were you on a branch other than master when you tried the the checkout?
When you checkout branches (or commits), the checked-out commit should become bold in SourceTree. As well, in the left sidebar, under 'BRANCHES', the checked-out branch should be bold. This should show you visually which commit you're looking at. If you check out a commit that's not the tip of the branch you'll aosl see the HEAD indicator showing you which commit is checked out.
If you use Control-click or Command-click (depending on whether you're on a PC or a Mac) to select two commits, the bottom panel will show you the diff between them. I'd suggest looking at the diff between two commits you're interested in, and then checking out from one to the other to confirm that the working directory changes the same way the diff says it will. It should.
Does SourceTree show uncommitted changes? You can't checkout while you have uncommited changes - but it should give you a specific error message for that situation.
Did you commit the changes that contained the error? On which branch? If you commited the wrong changes on the master branch and want to revert them, you'll want to use a hard reset rather than checkout so that you can continue committing on the branch.
If all else fails, I'd suggest trying the command line a bit. Having a familiarity with basic git command line commands will improve you're understanding of what SourceTree is doing. Try "git status" "git branch" "git log --oneline" - what do they show you? And then try using "git checkout <branch_or_commit_id>" to change your working directory at the command line.
Those are my thoughts - none quite coherent enough to qualify as an 'answer'. If none of that helps, post a screenshot of the branch diagram from SourceTree along with the specifics of what commit or branch you're trying to check out (and are you using the 'Commit' button or just double-clicking on branch or commit in the diagram?)
Yes, when I selected what to checkout, I was on the master and it "was" blue. I'll have to check on the "Head" thing more. Oh... I also see "Uncommitted Files" at the very top. I checked out doing the "Reset", but it seems a little scary to me <g>. I checked out this post https://answers.atlassian.com/questions/317478
All changes that I commit have no errors. That was a BIG no no when I used to develop software. We would go "off" on one of our guys that did that. I've used source control before, but it's been a while. I've been retired for 20 years now. I'm an old guy and we used our intranet and used the command line to "put" and "get". Can't remember what brand of source control we used.
Oops... Just noticed that you talk about the command line. I think you're right. I'm going to work on that. Thanks for giving me the most used commands.
And don't worry. You have been a big help to me. I understand what you are saying. I won't write back for a while with how things are doing unless I crash and burn my repository.
This community is celebrating its one-year anniversary and Atlassian co-founder Mike Cannon-Brookes has all the feels.Read more
Bitbucket Pipelines helps me manage and automate a number of serverless deployments to AWS Lambda and this is how I do it. I'm building Node.js Lambda functions using node-lambda ...
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