Back to Git & Dev Tools
2026-01-038 min read

Install Git with Atlassian Sourcetree (Git & Dev Tools)

Learn Install Git with Atlassian Sourcetree (Git & Dev Tools) step by step with clear examples and exercises.

Why This Matters

In today's fast-paced software development landscape, version control systems are essential tools for developers to manage and collaborate on code efficiently. Git, an open-source distributed version control system, is widely recognized as the industry standard. Atlassian Sourcetree, a graphical interface for Git, simplifies the process of using Git by offering a user-friendly experience that caters to both beginners and experienced developers alike.

By learning how to install and use Git with Atlassian Sourcetree, you'll be able to:

  1. Collaborate effectively on projects with other developers.
  2. Track changes made to the codebase over time.
  3. Easily switch between different versions of your project.
  4. Merge and resolve conflicts when working on shared branches.
  5. Backup and restore your codebase with ease.
  6. Streamline your workflow by leveraging Git's powerful features within a user-friendly interface.
  7. Gain a competitive edge in the job market as proficiency in Git is highly valued by employers.

Prerequisites

To follow this tutorial, you should have:

  1. Basic understanding of operating systems (Windows, macOS, or Linux).
  2. A text editor installed on your system (such as Visual Studio Code, Sublime Text, Notepad++, or any other code editor you prefer).
  3. Familiarity with the command line interface (CLI) and navigating directories. If you're new to the CLI, consider spending some time learning basic commands like ls, cd, and mkdir.
  4. A desire to learn Git and Atlassian Sourcetree!

Core Concept

Git is a distributed version control system that allows multiple developers to work on the same project simultaneously without overwriting each other's changes. It tracks modifications made to files, enables collaboration, and makes it easy to manage different versions of your codebase.

Atlassian Sourcetree provides a graphical user interface (GUI) for interacting with Git repositories, making it easier for developers to visualize their workflow and perform common Git operations without having to remember complex command-line commands.

Key Git Concepts

  1. Repository: A collection of files that are managed by Git. Each repository contains a .git directory, which stores the metadata and history of the project.
  2. Commit: A snapshot of the current state of the repository. Commits allow developers to save their work at specific points in time and track changes made to the codebase.
  3. Branch: A separate line of development within a Git repository. Branches enable developers to work on different features or fixes without affecting the main codebase (usually the master branch).
  4. Merge: The process of combining changes from two branches into one. Merging allows developers to integrate their work and collaborate effectively.
  5. Pull Request: A request to merge a branch into another, typically submitted by a developer who wants to contribute changes to a shared repository. Pull requests allow other developers to review the proposed changes before they are merged.
  6. Remote: A Git repository that is hosted on a server or cloud service. Remotes can be local (on the same machine) or remote (on another machine or service).
  7. Clone: The process of copying an existing Git repository to your local machine, creating a new local repository with the same history and structure as the original.

Worked Example

Let's walk through an example of using Atlassian Sourcetree to manage a simple project:

  1. First, we'll create a new directory for our project and navigate into it using the command line:
mkdir my-project && cd my-project
  1. Next, we'll initialize a new Git repository by running git init in the terminal. This creates the necessary .git directory within our project folder.
  1. Now that we have a Git repository, let's create a simple file called index.html and add some content:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>My Project</title>
</head>
<body>
<h1>Welcome to My Project!</h1>
</body>
</html>
  1. Open the index.html file in your code editor and make some changes, such as updating the title or adding more content.
  1. To stage our changes for commit, open Atlassian Sourcetree, navigate to the my-project repository, right-click on index.html, and select "Stage Changes" > "All". This stages the selected file for commit.
  1. Click on the "Commit" button in the toolbar, enter a commit message (e.g., "Initial commit"), and click "Commit & Push". This commits the staged changes to the local repository and pushes them to the remote repository (if you have push access).
  1. To create a new branch for feature development, right-click on the master branch, choose "Create Branch", enter a name for the new branch (e.g., feature/new-page), and click "Create". Switch to the new branch by right-clicking on it and selecting "Checkout".
  1. Make some changes to the index.html file in your code editor, such as adding a new section for a new page.
  1. Stage and commit the changes as before, but this time only on the feature/new-page branch.
  1. To merge the new page into the master branch, right-click on the master branch, choose "Merge", select the feature/new-page branch, and click "OK". Resolve any merge conflicts that may arise, if necessary.
  1. Once the merge is complete, you can delete the feature/new-page branch by right-clicking on it and selecting "Delete Branch".

Common Mistakes

1. Forgetting to commit before pushing

If you've made changes to your local repository but haven't committed them yet, attempting to push will result in an error. Make sure to stage and commit your changes before pushing to the remote repository.

Solution:

Stage and commit your changes using Atlassian Sourcetree or the command line before pushing.

2. Ignoring files by accident

Sourcetree allows you to ignore specific files or directories from being tracked by Git. Be careful not to accidentally add unwanted files to the .gitignore file, as this will prevent them from being committed and synced with the remote repository.

Solution:

Review the contents of your .gitignore file and ensure that it only includes necessary exclusions. If you need to track a previously ignored file, remove its entry from the .gitignore file and commit the changes.

3. Merging conflicts

When working on shared branches, it's possible for two or more developers to make conflicting changes to the same lines of code. In such cases, you'll need to manually resolve the merge conflict by editing the affected files and committing the resolved version.

Solution:

Open the affected files in your code editor, resolve any conflicts by either merging the changes or choosing one version over the other, save the file, stage it for commit, and then complete the merge as usual.

Practice Questions

  1. What is Git, and why is it important for software development?
  • Git is a distributed version control system that enables developers to manage their code efficiently. It's essential for software development because it allows multiple developers to collaborate on the same project without overwriting each other's changes, tracks modifications made to files, and makes it easy to switch between different versions of a project.
  1. How can Atlassian Sourcetree help simplify using Git for developers?
  • Atlassian Sourcetree provides a graphical user interface (GUI) for interacting with Git repositories, making it easier for developers to visualize their workflow and perform common Git operations without having to remember complex command-line commands.
  1. Describe the steps to create a new Git repository using Sourcetree.
  • To create a new Git repository using Sourcetree:
  1. Open Atlassian Sourcetree.
  2. Click on the "Clone" button in the toolbar.
  3. In the "Repository" field, enter the URL of the repository you want to clone (e.g., https://github.com/username/repository-name.git).
  4. Choose a local path for your repository by clicking on the "..." button next to the "Local Path" field and selecting an appropriate directory.
  5. Click "Clone". Sourcetree will clone the repository and display it in the main window.
  1. Explain how to stage, commit, and push changes in Sourcetree.
  • To stage, commit, and push changes in Sourcetree:
  1. Select one or more files in the repository view, right-click, and choose "Stage Changes" > "All". This stages the selected files for commit.
  2. Click on the "Commit" button in the toolbar, enter a commit message, and click "Commit & Push". This commits the staged changes to the local repository and pushes them to the remote repository (if you have push access).
  1. What should you do if you encounter a merge conflict while working on shared branches with Sourcetree?
  • If you encounter a merge conflict while working on shared branches with Sourcetree, open the affected files in your code editor, resolve any conflicts by either merging the changes or choosing one version over the other, save the file, stage it for commit, and then complete the merge as usual.

FAQ

Q: Can I use Atlassian Sourcetree on multiple computers?

A: Yes, you can install and use Sourcetree on multiple computers as long as you have access to the remote Git repositories. However, each installation will be independent of the others.

Q: Is it necessary to learn command-line Git if I'm using Atlassian Sourcetree?

A: While Sourcetree provides a user-friendly interface for interacting with Git repositories, understanding the underlying command-line commands can help you troubleshoot issues and perform more advanced operations. It's recommended to learn both the GUI and CLI versions of Git.

Q: How do I handle large files when using Git?

A: Large files can cause performance issues when working with Git, especially if they are frequently modified or need to be synced between multiple developers. To address this, consider splitting large files into smaller pieces, compressing them, or using a version control system that supports binary files more efficiently (such as Mercurial or Perforce).

Q: Can I use Sourcetree for version control of non-code files like images or documents?

A: Yes, Git is capable of managing any type of file, including images, documents, and other assets. However, be aware that some types of files may require special handling due to their size or content. Consult the documentation for your specific use case if you encounter issues.

Install Git with Atlassian Sourcetree (Git & Dev Tools) | Git & Dev Tools | XQA Learn