cheatsheet-git
Table of Contents
Cheatsheet GIT
Summary: Git hints, tips, oneliners and best practices.
Date: 8 December 2024
General
Check git repository sizegit count-objects -vH
Combine fetch and merge to completely update a repositorygit pull
Log & Diff
Show git loggit log
Show the files which have changed between the branch and mastergit diff --name-only master..branchtocheck
Branches
Create and immediately checkout a branchgit checkout -b "#123456-add-dns-resolving"
Show all branchesgit branch -a
Show all active branchesgit ls-remote --heads origin
Merge changes from master branch, perform from inside the branchgit merge master
Git Remotes
Show remotegit remote -v
Update the remote “origin” with a new url in case of a rename of the repo or projectgit remote set-url origin https://getshifting@dev.azure.com/getshifting/Infra/_git/infraplayground
Commits
Add and commit a new filegit add . git commit -m "Added new file"
Add and commit in 1 go for changed filesgit commit -am "changed a file"
Co-Authoring / Pair coding commit messageChanged a couple of files Co-Authored-By: Sjoerd <sjoerd @ getshifting.com>
Do not trigger CI in Azure DevOps***NO_CI***
cheatsheet-git.txt · Last modified: by 127.0.0.1