Commit a file
We are going to add a new file and have it registered under the repository we just created.
Create a file named sample.txt
in that directory with the following text content.
Anyone can learn Git with this tutorial and Backlog
Double-click the “tutorial” repository in Sourcetree’s bookmarks window to prompt the repository operations window. If there are any newly added or edited files within the directory will be displayed in the bottom-left of the working tree file inspector.
Because we just added the sample.txt
file into the tutorial
directory, we see it listed there.
Right-click the “sample.txt” file and choose “Add to Index.” The file will move to the “Files staged in the index” list above.
Click the “Commit” icon on the toolbar, enter a commit message (e.g., “first commit”), and click “Commit.”
Once complete, you will find the commit in the “main” branch history. You can verify that the commit was successful by clicking “History” on the left menu.
Next, you’re ready to share the repository with your team.