14 Kasım 2016 Pazartesi

Git commitlerini birlestirme (Squash)


Tig veya git log ile commitlere bakalim.

 o [terminix] {origin/terminix} fixed typo
 o changed maintainer
 o added xxx to maintainers list
 o terminix package
 o added terminix package


git rebase -i HEAD~5 terminix

Bu komut ile kac commiti birlestircegimizi(5) ve hangi branchteki commitleri birlestircegimizi soyledik(terminix).
Bize asagidaki gibi bir ekran gelicek.

pick bea4d9f added terminix package
pick a078c8f terminix package
pick c02531d added xxx to maintainers list
pick 87a6528 changed maintainer
pick 3bf3b28 fixed typo

# Rebase bb2a67d..3bf3b28 onto bb2a67d (5 commands)
#
# Commands:
# p, pick = use commit
# r, reword = use commit, but edit the commit message
# e, edit = use commit, but stop for amending
# s, squash = use commit, but meld into previous commit
# f, fixup = like "squash", but discard this commit's log message
# x, exec = run command (the rest of the line) using shell
# d, drop = remove commit
#
# These lines can be re-ordered; they are executed from top to bottom.
#
# If you remove a line here THAT COMMIT WILL BE LOST.
#
# However, if you remove everything, the rebase will be aborted.
#
# Note that empty commits are commented out


Birlestirmek(Squash) istediklerimizi s veya squash olarak degistirip kaydediyoruz. Uzerine birlestirmek istedigim commiti pick olarak birakiyoruz.

pick bea4d9f added terminix package
s a078c8f terminix package
s c02531d added xxx to maintainers list
s 87a6528 changed maintainer
s 3bf3b28 fixed typo

Squash olarak degistirdiklerimizi belirledikten sonra bize birlestirilcek olan commitleri gosteriyor en son. Burda 1. commiti istersek adini degistirebiliriz. Hersey birinci commit uzerine yazilcak.

# This is a combination of 5 commits.
# This is the 1st commit message:
added terminix package

# This is the commit message #2:

terminix package

# This is the commit message #3:

added xxx to maintainers list

# This is the commit message #4:

changed maintainer

# This is the commit message #5:

fixed typo

Not: Yaptiginiz degisiklikleri geri almak isterseniz rebase islemi sirasinda; git rebase --abourt komutunu kullanabilirsiniz.

git push origin +simplenote

Githubtaki repomuza forcelayarak degisikliklerimizi gonderiyoruz.
Forcelama islemi branch adinin basina (+) koyarak gerceklestiriliyor.