🐙
Git Developer Guide
About
  • Overview
  • Scope of this book
  • Table of Content
  • 🐢Introduction to Version Control
    • What is Version Control?
    • Overview of git and it's benefits
    • Setting up Git on Different Platforms
  • 🍼Git Fundamentals
    • Initialising a new Git repository
    • Understanding the Git Workflow
    • Committing Changes and Writing Good Commit Messages
    • Viewing and Navigating Commit History
    • Git Basics - Practice Scenarios
      • Initialising a Git Repository
      • Committing Changes
      • Exploring Commit History
      • Amending and Undoing Commits
  • 🦕Working With Git
    • What is Git Branch?
    • Creating and Switching Between Branches
    • Merging Branches and Resolving Conflicts
    • Best Practices for Branch Management
    • Git Workflows
    • Git Log
    • Git Stash
    • Working with Git - Practice Scenarios
      • Creating and Switching Between Branches
      • Merging Branches and Resolving Conflicts
      • Branching Strategies in a Team Project
      • Rolling Back to a Previous Version
      • Experimenting with Feature Branches
      • Working with Stash
  • 🤝Working with Remote Repositories
    • Cloning a Repository from Remote
    • Pushing and Pulling Changes to and from Remote Repositories
    • Collaborative Workflows - Forking, Branching, and Pull Requests
    • Resolving Conflicts in a Collaborative Environment
    • Collaborating with Git - Practice Scenarios
      • Cloning a Remote Repository
      • Pushing and Pulling Changes
      • Collaborative Workflow with Forking and Pull Requests
      • Resolving Conflicts in a Pull Request
  • 🏆Advanced Git Features
    • Aliases and Custom Configurations
    • Working with Tags and Releases
    • Rewriting Commit History with Interactive Rebase
    • Utilising Git Hooks for Automation
    • Advanced Git Features - Practice Scenarios
      • Creating Custom Git Aliases
      • Working with Tags and Releases
      • Rewriting Commit History with Interactive Rebase
      • Using Git Hooks for Automated Testing
  • 😎Git in Real-World
    • Managing a Project with Multiple Contributors
    • Integrating Git with Continuous Integration, Continuous Deployment (CI, CD)
    • Versioning Assets with Git LFS (Large File Storage)
    • Deploying a Web Application using Git
    • Git In Real World - Practice Scenarios
      • Managing a Project with Multiple Contributors
      • Integrating Git with CICD Pipelines
      • Versioning Assets with Git LFS
      • Deploying a Web Application using Git
  • Git Troubleshooting
    • Common Mistakes and Pitfalls When Using Git
    • Undoing Changes with Git - Reverting and Resetting
    • Recovering Lost Commits or Branches
    • Dealing with Repository Corruption or Other Issues
  • Git Best Practices and Tips
    • Creating efficient git workflows: writing clean code for faster reviews
    • The importance of clean code in collaborative development
    • Significance of consistent naming conventions & coding Standards
    • Good code documentation for better git workflows
    • Writing meaningful git commit messages
    • Atomic commits in git & it's benefits for software teams
    • Structuring code & managing dependencies for better git workflows
    • Git branching strategies for software teams
  • Conclusion & Next Steps
    • Recap of Key Concepts and Commands
    • Further Resources for Expanding Git Knowledge
    • Encouragement and Tips for Continued Learning and Practice
  • License Considerations
Powered by GitBook
On this page

Was this helpful?

  1. Introduction to Version Control

Setting up Git on Different Platforms

Git is a distributed version control system that allows you to track changes and collaborate on projects

PreviousOverview of git and it's benefitsNextInitialising a new Git repository

Last updated 1 year ago

Was this helpful?

In order to start using Git, you need to set it up on your preferred platform. This chapter will guide you through the installation process on Windows, macOS, and Linux.

Additionally, we will cover the configuration of Git with user details and introduce both the Git command line interface (CLI) and graphical user interfaces (GUIs).


Installation instructions for Windows

Download Git:

  • Visit the official Git website:

  • Click on the "Downloads" link.

  • This will automatically detect your operating system and provide the download link for the latest version of Git for Windows.

  • Click the download link to start the download.

Run the installer:

  • Once the download is complete, locate the downloaded file (e.g., Git-x.x.xx-64-bit.exe).

  • Double-click the file to run the installer.

  • If prompted by User Account Control, click "Yes" to allow the installation.

Customise the installation:

  • The installer will provide you with various options during the installation process.

  • It is recommended to stick with the default options unless you have specific requirements.

  • Ensure that the "Git Bash Here" option is selected, as it will be useful for working with Git through the command line.

Complete the installation:

  • Follow the prompts and click "Next" to proceed through the installation process.

  • When you reach the "Adjusting your PATH environment" screen, select the option "Git from the command line and also from 3rd-party software."

  • Leave the other options as they are unless you have a specific need to modify them.

  • Click "Next" to continue.

  • On the next screen, select the desired text editor for Git. You can choose the default editor or any other editor of your preference.

  • Click "Next" and then "Install" to begin the installation process.

  • Once the installation is complete, click "Finish" to exit the installer.

Verify the installation:

  • Open the command prompt or Git Bash.

  • Type the following command to check if Git is installed and properly configured:

git --version
  • If Git is installed correctly, it will display the installed version.


Installation instructions for macOS

Homebrew installation (recommended):

  • Open the Terminal application. You can find it in the "Utilities" folder within the "Applications" folder.

  • Run the following command to install Homebrew, a package manager for macOS:

/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
  • Follow the instructions provided by the installer.

Git installation:

  • Once Homebrew is installed, you can use it to install Git by running the following command

brew install git
  • Homebrew will handle the installation and set up Git on your macOS system.

Verify the installation:

  • Open the Terminal.

  • Type the following command to check if Git is installed and properly configured:

git --version
  • If Git is installed correctly, it will display the installed version.


Installation instructions for Linux

Package manager installation:

  • Different Linux distributions have different package managers.

  • Use the appropriate package manager for your distribution to install Git.

  • For example, on Ubuntu or Debian-based systems, you can use the following command:

sudo apt-get update
sudo apt-get install git

Verify the installation:

  • Open the terminal.

  • Type the following command to check if Git is installed and properly configured:

git --version
  • If Git is installed correctly, it will display the installed version.


Configuring Git with user details

Once Git is installed, it is essential to configure it with your user details. This information is used to identify the author of the commits you make.

To configure Git with your user details, open the command line or terminal and execute the following commands, replacing the placeholders with your actual name and email address:

git config --global user.name "Your Name"
git config --global user.email "youremail@example.com"

The --global flag sets the configuration globally for your user account. If you want to override these settings for a specific project, you can navigate to the project directory and omit the --global flag when running the commands.

Introduction to Git command line interface (CLI) and graphical user interfaces (GUIs):

Git provides two primary ways to interact with the version control system: through the command line interface (CLI) and graphical user interfaces (GUIs).

The CLI offers a powerful and flexible way to work with Git, providing access to all Git commands and options. It is especially useful for advanced usage, automation, and scripting. You can open the command prompt or terminal and use Git commands directly.

On the other hand, Git GUIs provide a more user-friendly and visual representation of Git's functionality. They often include features like commit history visualisation, branch management, and conflict resolution tools. Several popular Git GUIs are available, including:

Git GUIs can be helpful for beginners or users who prefer a visual interface for working with Git.

It's important to note that the CLI and GUIs are complementary, and you can choose the approach that best suits your workflow and preferences. Both methods provide access to the same underlying Git functionality.

With Git properly installed, configured, and an understanding of the available interfaces, you are now ready to start using Git for version control.

GitKraken:

Sourcetree:

GitHub Desktop:

🐢
https://git-scm.com
https://www.gitkraken.com
https://www.sourcetreeapp.com
https://desktop.github.com