Minimalistic Git cheatsheet (updatable)
A minimalistic updatable git cheatsheet containing basic git commands that are useful for everyday use.
Basic commands
Create a repository:
$git init
Clone a remote repository:
$git clone https://www.example.com/examples/example.git
Check changes in the repository:
$git status
Add all changes to the repository:
$git add .
Commit added changes to the repository:
$git commit -m "commit message"
Push all commits to the remote git hosting (like GitHub, GitLab or Codeberg):
$git push
Branches
View branches:
$git branch
Create new branch named “branch-name”:
$git branch branch-name
Checkout a branch named “branch-name”:
$git checkout branch-name
Merge changes between two branches. Let's say we have “dev” and “new-feature” branches. And we would like to merge “new-feature” into “dev”. So we do:
$git checkout dev
$git merge new-feature
$git push # if needed
Remove old unused branch both locally and remotely:
$git branch -d local-branch-name # delete branch locally
git push origin --delete remote-branch-name # delete branch remotely
— Keywords: #Dev #Indiedev #Git #Howto #Cheatsheet Image: www.20i.com