Skip to content

Git

Source: https://www.atlassian.com/git/tutorials/atlassian-git-cheatsheet

CommandDescriptionExample
git initInitialize repository
git cloneClone repositorygit clone https://github.com/homelabwithkevin/docs.homelabwithkevin.com
git addStage file/directorygit add git.md
git commit -m Commit staged files/directories, with messagegit commit -m ‘update doc’
git statusGet status of repo (stashed files, branch)
git log —pretty=onelineGet log of repo
git reflogGet detailed log of repo
git diffGet difference between committed and staged/unstagedgit diff git.md
git fetchFetch repo (does not pull)
git pullFetch repo and immediately merge into local
git pushPush committed changes to remote branch
git rebase -i HEAD~XRebease to X commits ago, used for squashing sometimesgit rebase -i HEAD~3
git merge —squashSquash commit merge into the current branchgit merge example —squash