Make your first commit to the local Git repository, using SourceTree.
- [Narrator] We're ready now to tell SourceTree about our application, and to get our local repository into SourceTree so that we can manage it there. We'll click on New Repository, and from this menu we will say Add Existing Local Repository. It's going to open up a finder window for us. We're going to click on the directory where we find our project. We're going to click on the directory where we find our project, and click Open.
It has immediately placed that local repository into SourceTree. If we double-click, it opens up our main SourceTree window. Here we can see the files that are associated with this project. Let's go over to the year, lower that for a moment, and come over to Advanced. We want to double check to make sure that our name and email are in place, which they are.
We also may want to look at where the gitignore file is, and that's exactly where we placed it, and from here we could edit that file as well. Let's click OK, and now we're pretty much ready to go. The first thing that we want to do is add these files to the repository. We do so by clicking Commit and putting in a Commit Message. We're going to talk about Commit Messages in some detail, but for now we're just going to call this one First Commit, and click the Commit button.
Notice that now we have nothing to Commit. If we come over to branches and click Show, we'll find that there's one branch called the master branch. There's always a master branch. This open circle indicates that that is the current branch. Doesn't have a lot of meaning right now because we only have one, but as we go along, we'll have more than one. If we double-click on master, we can find the Commit we just did. Here it says master, there's our message, First Commit. Every Commit has a hash value, and this is the first numbers in that value.
It tells us who the author is, and you can see the beginning of the email, and when that Commit occurred. We can get a little more information down here at the bottom, let me expand that a bit for you. And here we see what files were committed, the message, the full Commit hash, who actually made the Commit, the date, and so forth. On each of these files, we can see what the text is, and when we have changes, we'll be able to see what those changes were.
- SourceTree settings and preferences
- Committing files and messages
- Examining the basic flow
- Branching and merging
- Resolving conflicts
- Reversing the commit
- Adding to the stash
- Restoring from the stash
- Using the Terminal