Git Rebase

Rebase is used in merging two or more commits into one. Per experience, you can only rebase to an older commit.

Say, in these commits

1~$ git log -2 --pretty=oneline
2a0dd6b55000399c5f8b5f0f55286e167725e51c2 (HEAD -> v0.2.x_wip, origin/v0.2.x_wip) docktie_cli getx: Tested working implementation for #17.
3fb8f1de0cf1af7b447dfc9275878c516384f3a0d docktie_cli getx: initial implementation wip for #17

Older one is fb8f1de0cf1af7b447dfc9275878c516384f3a0d

Run:

1~$ git rebase --interactive HEAD~2

You'll be in an interactive mode (in an editor)

 1pick fb8f1de docktie_cli getx: Implementation for #17.
 2pick a0dd6b5 docktie_cli getx: Tested working implementation for #17.
 3
 4# Rebase bc15f56..a0dd6b5 onto bc15f56 (2 commands)
 5#
 6# Commands:
 7# p, pick <commit> = use commit
 8# r, reword <commit> = use commit, but edit the commit message
 9# e, edit <commit> = use commit, but stop for amending
10# s, squash <commit> = use commit, but meld into previous commit
11# f, fixup <commit> = like "squash", but discard this commit's log message
12# x, exec <command> = run command (the rest of the line) using shell
13# b, break = stop here (continue rebase later with 'git rebase --continue')
14# d, drop <commit> = remove commit
15# l, label <label> = label current HEAD with a name
16# t, reset <label> = reset HEAD to a label
17# m, merge [-C <commit> | -c <commit>] <label> [# <oneline>]
18# .       create a merge commit using the original merge commit's
19# .       message (or the oneline, if no original merge commit was
20# .       specified). Use -c <commit> to reword the commit message.
21#
22# These lines can be re-ordered; they are executed from top to bottom.
23#
24# If you remove a line here THAT COMMIT WILL BE LOST.
25#
26# However, if you remove everything, the rebase will be aborted.
27#
28# Note that empty commits are commented out

Focus on the uncommented part (those without #).

1pick fb8f1de docktie_cli getx: Implementation for #17.
2pick a0dd6b5 docktie_cli getx: Tested working implementation for #17.

Change the 'pick' for the newer commit to 'fixup' like below:

1pick fb8f1de docktie_cli getx: Implementation for #17.
2fixup a0dd6b5 docktie_cli getx: Tested working implementation for #17.

and save

Push your commit now. If already pushed, you would need to force it: git push -f

More details in https://stackoverflow.com/questions/2563632/how-can-i-merge-two-commits-into-one-if-i-already-started-rebase