Useful Command in git
Belajar GIT dari awal di PPTI Qodr. daftar sekarang (opens in a new tab)
Log one line per commit
git log --oneline
log fancy :v
git log --oneline --decorate --all --graph
log with author
git log --pretty=format:"%h - %an, %ar : %s"
Log with date
git log --pretty=format:"%h - %an, %ar : %s" --date=iso
Log with date and time
git log --pretty=format:"%h - %an, %ar : %s" --date=iso-local
check the difference between two branches
git diff branch1..branch2
example :
git diff main..develop
check the difference between two branches with file
git diff branch1..branch2 -- filename
example :
git diff main..develop -- package.json
check the difference between two commits
git diff commit1..commit2
example :
git diff 123456..abcdef
check the difference between two commits with file
git diff commit1..commit2 -- filename
example :
git diff 123456..abcdef -- package.json
show remote url
git remote -v
show remote url with name
git remote show origin
show remote branches
git branch -r
show all branches
git branch -a
shorthand for git add then commit
git commit -am "commit message"
show all commits
git reflog
partial commit
git add -p