• Document

Git Cheatsheet

Undo last X commits to cherry-pick changes

# this will undo the last commitgit reset HEAD~1# find the commit hash before the last commit with the correct changes for those files, this will also discard the changesgit restore --source <commit sha> file1, file2, etc# add back the changes you do wantgit add file1, file2, etc# push the new commit git commit -m "remove unneeded changes"git push

Configure new Git installation

git config --global user.name "Jebb Burditt"git config --global user.email "jebb.burditt@gmail.com"

Prune branches after merging to trunk

git config --global fetch.prune true

Merge in latest changes to current feature branch

git stashgit fetch origin develop:developgit merge developgit stash pop

GIT line endings

# Windows checkout change LF to CRLF and on push change and CRLF to LF git config --global core.autocrlf true# Run to update the files found with 'git status' that only have line ending changesgit add --renormalize .