Skip to content

Latest commit

 

History

History
88 lines (63 loc) · 1.94 KB

Git.md

File metadata and controls

88 lines (63 loc) · 1.94 KB

Setup Git

Installation

Windows

choco install git

For Powershell also set the HOME environment variable, as per this answer on StackOverflow.

setx HOME c:\Users\<your_user_name>

MacOS

brew update
brew install git

Debian-based

sudo apt update
sudo apt upgrade
sudo apt install git

Redhat-based

sudo yum upgrade
sudo yum install git

Documentation

Alternatively follow the Official Documentation 🗗

Configuration

The most common way to configure git is to change the global configuration for a user on a machine. Assuming this is what we want to achieve, the --global flag is used.

Line-endings

Let's all just agree that we only need \n characters.

To not enforce this globally we keep end of line enforcement at native but disable autocrlf.

git config --global core.eol native
git config --global core.autocrlf input

User credentials

git config --global user.name <your-username>
git config --global user.email <your-email-address>

The recommended way of connecting to a git repository is by using ssh key, protected by a password. Note that you might end up typing this password a few times a day so don't make it too long.

There is an excellent documentation by github on how to create and configure an ssh key 🗗.

Enable colors

git config --global color.ui auto
git config --global color.branch auto
git config --global color.status auto

Enable rebasing by default

# Never rebase branches that are team-shared
git config --global branch.main.rebase false
git config --global branch.master.rebase false
git config --global branch.develop.rebase false

# Always rebase feature branches
git config --global branch.autosetuprebase always