Tworzenie nowego lokalnego brancha
git checkout -b name_of_new_local_branch
Tworzenie nowego zdalnego brancha
git push origin name_of_new_remote_branch
Usuwanie brancha
git branch -d name_of_local_branch
Diff dla ostatniej zmiany
git diff HEAD^
Diff dla zakresu wersji
git diff hash1 hash2
Merge do głównej gałęzi
git checkout master
git pull origin master
git merge name_of_local_branch
git push origin master
Lista tagów
git tag
Tworzenie taga
git tag <tag_name> <hash_of_commit_to_be_tagged>
Aktualizacja taga
git tag -a -f <tag_name> <hash>
Wypchnięcie taga na zdalny serwer
git push origin <tag_name>
Usunięcia taga na zdalnym serwerze
git push --delete origin <tag_name>
Ustawienie docelowego brancha gdy nie istnieje
git push -u origin name_of_branch
Ustawienie docelowego brancha gdy istnieje
git branch -u origin/remote_branch_name
Połączenie komitów podczase rebase
git rebase -i <hash-commit-before-changes> (e.g. HEAD~2 – for two commits to squash. Second and later commit must be changed to squash or fixedup).
Wymuszenie wypchnięcia zmian:
git push --force
Blame
git blame <hash/tag> -- <path_to_file> - hash is a starting point from which looks backward. To see previous file use “^” operator.
Historia zmian od danego użytkownika
git log --author=UserName
Historia zmian z danego hash-a
git show <hash>
Historia zmian z danego zakresu hash-y
git log hash1..hash2 -–pretty=oneline
git log hash1..hash2 -–pretty=”%h date %cD %s”