Skip to content

Latest commit

 

History

History
65 lines (50 loc) · 2.08 KB

Git_intermediate.md

File metadata and controls

65 lines (50 loc) · 2.08 KB

Intermediate Git

Zmniejszamy liczbę commitów, zmieniamy ich kolejność itp.

Another common practice is to rebase the last few commits in your current branch

Interactive rebase on GitHub

git checkout issue16                       # o ile commity są na tej gałęzi
git log --pretty=oneline HEAD~8..HEAD      # sprawdzamy ostatnich 8 commitów
git rebase -i HEAD~4                       # zmieniamy ostatnie 4 committy

.. edycja ..
....  edit -- jeśli chcemy poprawić ten commit lub coś do niego dodać
........  git reset HEAD^  # rollback the last commit
........  git status
........  git add --patch  # lub dodajemy/edytujemy pliki
........
........  git rebase --continue
....  reword -- poprawiamy tekst wpisu do log

Uwaga: Na stronie manuala gitrevisions jest opisane znaczenie: HEAD^, ^HEAD, HEAD~n.

Teraz sprawdzamy wpisy log i scalamy wprowadzone zmiany:

git log --pretty=oneline
git rebase master                          # o ile jesteśmy na gałęzi issue16
git checkout master
git merge issue16
git branch -d issue16                      # możemy usunąć scaloną gałąź

Undo różnych rzeczy

git reset --merge           # merge
git reset --hard ORIG_HEAD  # rebase

Stashing

czyli, odkładanie pracy na później...

git stash
git stash list
git stash apply stash@{0}  # przykłady
git stash drop  stash@{0}