| Type | Option | Config |
|---|---|---|
| System glogal | --system |
/etc/gitconfig |
| User global | --global |
~/.gitconfig |
| Repository local | $REPO/.git/config |
Basic user wide configuration
git config user.name "King Kuban"
git config user.email "king_kuban@myterritory.net"
git config --global alias.glog "log --graph --oneline"
#git config --global color.ui true # It is default from some version.
List branches
git branch -aSwitch to another branch
git checkout <name>Create branch
git branch <name>
git checkout <name>
or
git checkout -b <name>
Merge changes from different branch
git merge <name>Rename local branch
git branch -m <old-name> <new-name>Delete old branch on remote
git push origin --delete <old-name>Push new branch to remote and track it
git push origin -u <new-name>Sync with remote after branch delete
git fetch --all --pruneOnly we need is bare repository.
It is a convention bare repositories have suffix .git
Create repository
git init --bare repo.git
Or clone existing one.
git clone --bare repo repo.git