User Tools

Site Tools


git
Wyświetla zmiany dotyczące podanego pliku
git log -p filename
Wyświetla zmiany, które wysłane zostaną na serwer po wykonaniu commita
Tworzy paczkę
git archive --format=tar --prefix=tomatocart/ master | gzip > tomatocart_msp_module-02-jan-2012.tar.gz
Modyfikuje całą historię gita

Razu jednego, przez przypadek wysłałem zmianę zawierającą hasło w jednym z plików. Oto jak usunąłem niebezpieczną linię ze wszystkich commitów. UŻYWAĆ Z ROZWAGĄ!!!

git filter-branch --tree-filter 'sed -i "" "/bind_password/d" lib/ddrive/application.rb' HEAD

INFO: http://git-scm.com/book/ch6-4.html#The-Nuclear-Option:-filter-branch

Korzystanie z innych gałęzi sklonowanego repozytorium

Gdy sklonujemy zdalne repozytorium, git branch -a wyświetli nam wszystkie gałęzie. Aby pracować na takiej gałęzi należy utworzyć lokalną gałąź powiązaną ze zdalną.

git checkout -b experimental origin/experimental

INFO: http://stackoverflow.com/questions/67699/how-do-i-clone-all-remote-branches-with-git

Tworzenie zdalnych gałęzi
git push <remote-name> <local-branch-name>:<remote-branch-name>

INFO: http://stackoverflow.com/questions/1519006/git-how-to-create-remote-branch

Tworzenie gałęzi ze wcześniejszego //commita//
git branch branchname <sha1-of-commit>
git branch branchname HEAD~3

INFO: http://stackoverflow.com/questions/2816715/branch-from-a-previous-commit-using-git

Łączenie dwóch commitów w jeden
Usuwanie nieśledzonych plików i katalogów
Wysyłanie lokalnej gałęzi
Search through all the history for a string
git log -G player_password -p

INFO: http://stackoverflow.com/a/12430097/339767

List all files modified in a branch
git diff --name-only feature/core-player-limits $(git merge-base feature/core-player-limits production)

INFO: https://stackoverflow.com/a/10641810/339767

List recent branches
git branch --sort=-committerdate

INFO: https://stackoverflow.com/a/5188364/339767

Inspecting new codebase

What Changes the Most
git log --format=format: --name-only --since="1 year ago" | sort | uniq -c | sort -nr | head -20
Who Built This
git shortlog -sn --no-merges
Where Do Bugs Cluster
git log -i -E --grep="fix|bug|broken" --name-only --format='' | sort | uniq -c | sort -nr | head -20
Is This Project Accelerating or Dying
git log --format='%ad' --date=format:'%Y-%m' | sort | uniq -c
How Often Is the Team Firefighting
git log --oneline --since="1 year ago" | grep -iE 'revert|hotfix|emergency|rollback'
git.txt · Last modified: 2026/04/08 17:38 by sqbell