= Cheatsheet GIT =
**Summary**: Git hints, tips, oneliners and best practices. \\
**Date**: 8 December 2024 \\
{{tag>cheatsheet git}}
== General ==
> Check git repository size
git count-objects -vH
\\
> Combine fetch and merge to completely update a repository
git pull
== Log & Diff ==
> Show git log
git log
\\
> Show the files which have changed between the branch and master
git diff --name-only master..branchtocheck
== Branches ==
> Create and immediately checkout a branch
git checkout -b "#123456-add-dns-resolving"
\\
> Show all branches
git branch -a
\\
> Show all active branches
git ls-remote --heads origin
\\
> Merge changes from master branch, perform from inside the branch
git merge master
== Git Remotes ==
> Show remote
git remote -v
\\
> Update the remote "origin" with a new url in case of a rename of the repo or project
git remote set-url origin https://getshifting@dev.azure.com/getshifting/Infra/_git/infraplayground
== Commits ==
> Add and commit a new file
git add .
git commit -m "Added new file"
\\
> Add and commit in 1 go for changed files
git commit -am "changed a file"
\\
> Co-Authoring / Pair coding commit message
Changed a couple of files
Co-Authored-By: Sjoerd
\\
> Do not trigger CI in Azure DevOps
***NO_CI***