Skip to content

lifeparticle/Git-Cheatsheet

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

29 Commits
 
 
 
 
 
 

Repository files navigation

  1. Revert the main branch to a previous commit

  2. Create and switch to a new branch

git switch -c path_config
# Switched to a new branch 'path_config'
  1. List all local branches
git branch --all
  1. List all the remote brances
git branch -r
  1. Reset all changes after last commit

Undo chnages to tracked file:

git reset HEAD --hard
  1. Remove GIT History (Caution it delete all the commit history)
git checkout --orphan last
git add -A
git commit -am "fresh init"
git branch -D main
git branch -m main
git push -f origin main
  1. Bare repository
git clone --mirror [email protected]:lifeparticle/binarytree.git
  1. Log
git log --oneline
  1. Git bisect
git bisect start
git bisect bad
git bisect good
  1. Reduce Git repository size
git clone --mirror [email protected]:lifeparticle/binarytree.git
bfg --strip-blobs-bigger-than 1M binarytree.git
cd binarytree.git