git config --global user.name Süleyman
git config --global user.email [email protected]
cd ~/.ssh && ssh-keygen
# name keygen as github
# Run the command below and paste on auth key: **<https://github.com/settings/keys**>
# Linux: make sure xclip is installed
cat github.pub | xclip -selection clipboard
# Mac:
pbcopy < github.pub # cat github.pub | pbcopy
cat >> ~/.ssh/config <<'EOF'
Host github.com
HostName ssh.github.com
Port 443
User git
IdentityFile ~/.ssh/github
IdentitiesOnly yes
EOF
ssh-add --apple-use-keychain ~/.ssh/github
# Set an Alias as “git l” for graphed logs
git config --global alias.l "log --color --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --all"
# or
git config --global alias.ls "log --oneline --decorate --graph --all"
# Default Pruning
git config --global fetch.prune true
# Create merge commit message on merge by default
git config --global merge.ff false
# git config --global pull.ff false # if you want the same for pull
git config --global pull.ff true # allow merge if needed
git config -l

See all branches
# local
git branch
# local + remote
git branch -a
Create xyz branch
git branch xyz
Create xyz branch from another[master] branch and switch to it
git checkout -b xyz main
Create xyz branch from another[main] branch
git branch xyz main
Create a local branch from a remote[github] branch (you can use after cloning master branch)
git checkout -b xyz origin/xyz