Basic git commands

Get git version:
git version

Set global user name:
git config --global user.name "Full Name"

Set global email:
git config --global user.email "email@example.com"

Set global default branch name:
git config --global init.defaultBranch main

Create new branch:
git branch <newname>

Switch branch:
git checkout <branchname>

Merge with a branch
git merge <branchname> -m <merging message>

Clone a repository:
git clone https://github.com/your/repository.git

To get up to date from remote repo:
git pull

Check git status:
git status

To initialize:
git init

To stage edited files:
git add .

To commit the changes:
git commit -m "Changing summary"

To set a remote repository - SSH:
git remote add origin ssh://user@host.com:port/home/user/projects/myrepo.git

To get the remote list:
git remote -v

To push:
git push origin

To check the log:
git log --oneline

To reset a specified commit:
git reset --hard <commit hash>

Update remote to a reset position:
git push -f origin HEAD^:master

To add an alias:
git config --global alias.sac '!git add --all && git commit -m'

To edit the global config:
git config --global --edit

To view all global config:
git config -l