Git Overview

Git Setup

My default installation on linux:

yum install git -y

git config --global "USERNAME"
git config --global "EMAIL"
git config --global color.ui true
git config --global format.pretty oneline
git config --global push.default simple

ssh-keygen -t rsa -b 4096 -C "EMAIL" -P '' -f ~/.ssh/git
cat ~/.ssh/
# Add to SSH Keys in your github/gitlab/gitea account

echo "" >> ~/.ssh/config
echo "Host DOMAIN" >> ~/.ssh/config
echo "User git" >> ~/.ssh/config
echo "IdentityFile ~/.ssh/git" >> ~/.ssh/config
echo "IdentitiesOnly yes" >> ~/.ssh/config


Initializing a repo

A new/empty repo:

git init
git remote add origin
# After First Push
git branch --set-upstream-to origin/master

Clone a repo to the current dir:

git clone .
git branch --set-upstream-to origin/master

Upload Changes

git add .
git commit -m "Commit Message"
git push

Download Changes

git pull

Work with branches

# Create Branch
git checkout -b feature_x
# Switch Branch
git checkout master
# Delete Branch
git branch -d feature_x

Retrieved from "$'"1"