Skip to content

Instantly share code, notes, and snippets.

@antonybudianto
Created August 5, 2015 01:41
Show Gist options
  • Save antonybudianto/017dd620f774fa5cd192 to your computer and use it in GitHub Desktop.
Save antonybudianto/017dd620f774fa5cd192 to your computer and use it in GitHub Desktop.
Squash Commit PR
Squash PR Commits to One Commit:
1. Clone branchnya (misalkan nama branchnya patch-1)
git clone http://github.com/repo --branch patch-1 D:/test
2. git pull origin patch-1
3. git status, pastiin udah match origin ama local
4. Cek statusnya pake git log, pastikan commit yg mau digabung ada disana
5. git rebase -i HEAD~2 (2 berarti 2 commit terakhir)
6. Pas muncul, PASTIKAN cuma 2 commit yang kelist
# kalau isinya "noop" ato malah semua commit kelist:
# batalin aja: ctrl-c -> tutup buka lagi -> git rebase --abort
# kalau muncul gitu berarti ada salah pas clone/ada file keubah
7. Ganti pick jadi squash di commit yang mau digabungin
Teken "i" buat edit, pastikan pick selalu diatas squash,
8. Setelah edit, teken ESC, lalu ketik :wq, teken ENTER
9. Nanti bakal direbase, terus muncul lagi yang ada pesan
Di kasih comment (pake #) aja ke message commit yg gk mau dipake
10. Lalu di ESC, ketik :wq, teken ENTER
11. Lalu di push force
git push origin patch-1 --force
12. DONE, cek aja pull requestnya harusnya uda jadi 1 commit yg disquash
Squash Commits to One Commit [before pushed]:
1. Caranya mulai dari step 4 - step 10
2. Terus git log aja, pastiin commits yg digabungin uda jadi 1
3. Cek git status juga, pastiin gak ada masalah rebase, harusnya cuma ada status behind commits.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment