W poprzednim wpisie również pojawiła się komenda git rebase, z pomocą której zmieniona została nawa komita. Tutaj rozszerzenie. Na co jeszcze pozwoli nam git rebase? Co jeszcze można poprawić z jego pomocą? Wiele!

Co przygotowałam tym razem? Poniżej przepisy na połączenie komitów, usunięcie komita oraz rozdzielenie komita.

 

Exercise 4

We would like connect 2 commits and create one with the message from the first commit in history.

 

# In editor change ‘p’ to ‘f’ next to the commit which you would like connect.
p ‘Commit 1’
p ‘Commit 2’
f ‘Name of commit to change’

# Save changes

That’s it! 🙂

 

Exercise 5

We was checking branch history and we see that 1 commit has no sense. We would like remove it.

 

# In editor remove line with the commit which should be delete.
p ‘Commit’
p ‘Commit’ (delete line – delete commit)
p ‘Name of commit to change’

 

That’s it! 🙂

 

Exercise 6

We was checking branch history and … in too much files is in 1 commit! We should split commit to 2 commits.

 

# In editor change ‘p’ to ‘e’ next to the commit to change.
p ‘Commit’
p ‘Commit’
e ‘Name of commit to change’

# Create commits

# Continue rebase

 

That’s it! 🙂

Author: